Skip to content

SQL NULL Values

NULL marks a value that is missing: nothing has been recorded. It is not zero and it is not an empty piece of text. Those are values; NULL is the absence of one.

In the Invoices table of the example database, PaidDate is NULL for the two invoices that have not been paid yet:

InvoiceID Supplier Amount PaidDate
1001 Hartwell Lighting 24,600.00 2025-04-01
1002 Kestrel Catering 3,180.00 2025-03-28
1003 Ashby Camera Hire 41,250.00
1004 Kestrel Catering 2,940.00

A comparison with NULL is never true. PaidDate = NULL does not mean “has no paid date”; it asks whether the paid date equals an unknown value, and the answer to that is unknown too. So this query returns no rows at all:

SELECT InvoiceID FROM Invoices
WHERE PaidDate = NULL;

The same goes for <>, < and the other comparison operators.

IS NULL is the test for a missing value. To find the unpaid invoices:

SELECT InvoiceID, Supplier, Amount
FROM Invoices
WHERE PaidDate IS NULL;
InvoiceID Supplier Amount
1003 Ashby Camera Hire 41,250.00
1004 Kestrel Catering 2,940.00

IS NOT NULL finds the rows that do have a value. To find the paid invoices:

SELECT InvoiceID, Supplier, PaidDate
FROM Invoices
WHERE PaidDate IS NOT NULL;
InvoiceID Supplier PaidDate
1001 Hartwell Lighting 2025-04-01
1002 Kestrel Catering 2025-03-28

To show a stand-in value where a column is NULL, such as “unpaid”, see SQL Null Functions.