NULL means unknown
NULL is not a value; it is the absence of one. Any comparison with NULL is unknown, not true, so WHERE col = NULL matches nothing. Test it with IS NULL.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Missing emails, unshipped orders with no date, optional fields: every real table has NULLs, and every wrong report about them starts with treating NULL like a value.
How to think about it
Whenever a column can be empty, ask what the query does with unknown. Equality, arithmetic and NOT IN all give unknown; only IS NULL, IS NOT NULL and COALESCE handle it on purpose.
Worked example
SELECT name FROM customers WHERE email = NULL;No rows, ever: the comparison is unknown, and unknown is not true.
SELECT name FROM customers WHERE email IS NULL;The customers with no email: the only correct test.
SELECT name FROM customers WHERE email IS NOT NULL;The ones with an address.
Your turn
Orders that have not shipped.
SELECT id FROM orders WHERE placed NULL;
Run a query against real tables
The trap
NULL = NULL is unknown too. Two rows with a missing city are not 'in the same city' as far as = is concerned; GROUP BY, though, puts them in one group.