1 / 8

PostgreSQL ยท SQL foundations

NULL means unknown or absent

NULL is not zero, an empty string, or a special value that compares equal to itself. It marks missing or unknown information. A comparison such as NULL = 5 has an unknown result, so use IS NULL to test for missingness.

SELECT id
FROM customers
WHERE phone_number IS NULL;

IS NOT NULL selects rows where a value is present. A WHERE clause keeps only rows whose condition is true; false and unknown are both filtered out.