We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
NULL means unknown, so it never equals anything - not even another NULL - and WHERE col = NULL silently matches nothing. It also changes aggregates: COUNT(*) counts rows while COUNT(col) and AVG skip NULLs, a LEFT JOIN fills unmatched rows with NULLs that COALESCE (or NULLIF, going the other way) has to handle, and a single NULL inside NOT IN (subquery) empties the whole result. Interviewers use these to separate people who have debugged real data from people who have only read syntax.
4 problems across 2 schemas · 1 free for registered users. Each runs your query in an isolated SQLite sandbox with instant, graded feedback.
A quick data question to warm up before you write SQL. No signup needed.
Product data arrives in three normalised source tables: product, subcategory and category. The reporting model needs a single product dimension, and a product's category history must be kept when it changes. How should the data be prepared?
Keep the syntax at your fingertips with the free SQL quick references, then come back and solve.