Null (SQL)

From Wiki @ Karl Jones dot com
Revision as of 11:11, 19 February 2016 by Karl Jones (Talk | contribs)

Jump to: navigation, search

Null is a special marker used in Structured Query Language (SQL) to indicate that a data value does not exist in the database.

Description

Introduced by Edgar. F. Codd, SQL Null serves to fulfill the requirement that [[Relational database management system|relational database management systems (RDBMS) support a representation of "missing information and inapplicable information".

Codd also introduced the use of the lowercase Greek omega (ω) symbol to represent Null in database theory.

NULL is also an SQL reserved keyword used to identify the Null special marker.

Lack of a value is not zero

In terms of information, "lack of a value" is not the same thing as "a value of zero".

Lack of an answer is not no

Similarly, "lack of an answer" is not the same thing as "an answer of no".

Example

For example, consider the question "How many books does Juan own?" The answer may be :

  • "zero" (we know that he owns none)
  • "null" (we do not know how many he owns, or doesn't own)

In a database table, the column reporting this answer would start out with no value (marked by Null), and it would not be updated with the value "zero" until we have ascertained that Juan owns no books.

SQL null is a state (unknown) and not a value.

Null in other programming languages

This usage is quite different from most programming languages, where null means not assigned to a particular instance.


See also

External links