SQL NULL Explained: Why = NULL Fails (Use IS NULL)

NULL means unknown, so = NULL never matches. Use IS NULL / IS NOT NULL — with COUNT quirks and join pitfalls.

all rows WHERE kept rows
WHERE keeps only the rows that match your condition.

NULL is not a value

In SQL, NULL means “unknown / missing.” It is not 0, not '', and not “false.”

-- Wrong — never keeps NULL rows
WHERE status = NULL

-- Right
WHERE status IS NULL
WHERE status IS NOT NULL

Even NULL = NULL is not true — so two missing values never “match” with =.

-- Example: find orders with a missing status
SELECT order_id, status
FROM orders
WHERE status IS NULL;

Where NULLs bite you

Coalesce when you need a stand-in

SELECT COALESCE(status, 'unknown') AS status_label
FROM orders;

Use COALESCE for display/defaults — not as a substitute for understanding IS NULL.

FAQ

Why doesn’t WHERE column = NULL work?

NULL means unknown. Comparing unknown with = returns unknown, not true, so WHERE drops the row. Use IS NULL.

Is NULL the same as 0 or an empty string?

No. 0 and '' are values. NULL is the absence of a value.

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice filtering rows

Related guides