AnalystPracticeGuides
DashboardSign up

NULL in SQL: what it means and how to handle it

NULL means "unknown" or "missing", not zero and not empty text. Any comparison with NULL is unknown, so = NULL never matches. Use IS NULL and IS NOT NULL.

Watch it solved. Q1: missing values (IS NULL), from 0:33, in our video “SQL Interview Questions and Answers for Data Analysts (Easy to Hard)”. Pressing play loads the video from YouTube (privacy). Open on YouTube

How do you find missing values?

SELECT * FROM customers
WHERE phone IS NULL;

WHERE phone = NULL returns nothing, even when phones are missing.

How do aggregates treat NULL?

FunctionNULLs
COUNT(*)counted, it counts rows
COUNT(phone)ignored
SUM, AVG, MIN, MAXignored

That's why AVG(bonus) can be higher than you expect: rows without a bonus don't count as zero.

How do you replace NULL with a value?

SELECT name, COALESCE(phone, 'no phone') AS phone
FROM customers;

COALESCE returns the first value that isn't NULL. To count missing bonuses as zero: AVG(COALESCE(bonus, 0)).

Where do NULLs come from in results?

Mostly from LEFT JOIN, for rows without a match. Filtering those columns in WHERE removes the rows again.

Try it yourself. Practise this in a real database in your browser, with instant feedback.
Practise NULL values

Updated November 2026.

← All free guides