Null means *nothing* or *unknown*, depending on context. Please use the "sql-null" tag for SQL specific questions.
"Null" has different meanings depending on context.
Set theory
Null is another name for the empty set, denoted by the symbol ∅. For this reason, some programming languages use null
or nil
for the empty list or empty tuple. Lisp uses nil
to mean the empty list and the boolean value false.
Pointers and References
Null
(or sometimes nil
or None
), in programming languages that support it, is the value of an uninitialized variable, a pointer that doesn't point to a meaningful memory address, or an object that fails to respond to any message.
Nullable references were invented by C.A.R. Hoare in 1965 as part of the Algol W language. Hoare later described his invention as a "billion-dollar mistake".
For more information, see Null pointer.
Agreeing with Hoare's sentiment, many languages don't have a special null
value, choosing to use optional types instead.
Relational Databases
NULL
as a special marker in SQL or a relational database stands in place of a value that is missing, or in a join means "no corresponding row." The operators IS NULL
and IS NOT NULL
are required for comparisons to a literal null
: other comparisons between NULL
and any value evaluate to "unknown."
For more information, see Null (SQL).
ASCII
Null
or NUL
is the name given to the character with ASCII code zero (0
) - i.e. hex 00
. In some languages, notably C, NUL
is used to mark the end of a character string.
For more information, see Null character.