Data Type - Null Value

> (Data|State) Management and Processing > (Data Type|Data Structure)

1 - About

Every data type includes a special value, called the null value, sometimes denoted by the keyword NULL.

The data type of the null value implied by the keyword NULL cannot be inferred since the null value is in every data type

Although the null value is neither equal to any other value nor not equal to any other value — it is unknown whether or not it is equal to any given value.

A null is the absence of a value in a column of a row. Nulls indicate missing, unknown, or inapplicable data. A null should not be used to imply any other value, such as zero.

Null is the representation of “missing information and inapplicable information”.


3 - Database

  • Different database engines interpret NULLs in a UNIQUE constraint differently. SQLite, PostgreSQL, Oracle, MySQL, and Firebird do it one way. Informix, DB2, and MS-SQL do it another. So it is best to avoid using NULLs in UNIQUE column.
  • NULLs sort differently on different engines. SQLite sorts NULL values first. PostgreSQL and MySQL and most other database engiens sort NULL values last.

4 - Documentation / Reference