“Unknown” Values: NULL

A NULL value in a column means no entry has been made in that column. A data value for the column is “unknown” or “not available.”

NULL is not synonymous with “zero” or “blank.” Rather, null values allow you to distinguish between a deliberate entry of zero for numeric columns (or blank for character columns) and a non-entry, which is NULL for both numeric and character columns.

In a column where null values are permitted:

If you type the word ‘‘NULL’’ in a character column and include quotation marks, it is treated as data, rather than a null value.

Query results display the word NULL. For example, the advance column of the titles table allows null values. By inspecting the data in that column, you can tell whether a book had no advance payment by agreement (the row MC2222 has zero in the advance column) or whether the advance amount was not known when the data was entered (the row MC3026 has NULL in the advance column).

select title_id, type, advance 
from titles 
where pub_id = "0877" 
title_id     type             advance 
--------     ----------       --------- 
MC2222       mod_cook              0.00 
MC3021       mod_cook         15,000.00 
MC3026       UNDECIDED             NULL 
PS1372       psychology        7,000.00 
TC3218       trad_cook         7,000.00 
TC4203       trad_cook         4,000.00 
TC7777       trad_cook         8,000.00 
 
(7 rows affected)