SQL LEARNING PLATFORM
The concept that trips up almost every SQL beginner.
Learning Blocks
Interactive Queries
Concepts you'll master
What NULL actually means (and what it does not mean)
IS NULL and IS NOT NULL — the only correct way to check for NULL
Why NULL = NULL is not TRUE in SQL
COALESCE to handle NULL gracefully
🌟 Think of it this way: NULL is the answer to 'what is the name of your 10th child?' — it is not 'nothing' or 'empty'. It is 'this value does not exist / is unknown.' SQL treats it completely differently from zero or empty string.
SELECT name, manager_id FROM employees WHERE manager_id IS NULL;
❌ Common Mistake: WHERE manager_id = NULL will ALWAYS return 0 rows. NULL = NULL evaluates to NULL (unknown), not TRUE. This is defined by the SQL standard. Always use IS NULL or IS NOT NULL.
SELECT * FROM employees WHERE manager_id = NULL; ----> Returns 0 rows - WRONG SELECT * FROM employees WHERE manager_id IS NULL; ----> Returns 2 rows - CORRECT
SELECT name, COALESCE(CAST(manager_id AS CHAR), 'No Manager') AS
reports_to
FROM employees;💡 Engineering Insight: COALESCE is invaluable in analytics. When calculating revenue per customer, a NULL (no orders) should show ₹0, not distort averages. COALESCE(SUM(total), 0) handles this cleanly.
Practice your SQL skills