Chapter 0 · Lesson 3 of 3
Missing Values with NULL
Understand how SQL represents missing or unknown values with NULL, why NULL is not zero or an empty string, and how to test for it with IS NULL.
Real data often has missing or unknown values. SQL represents those values with NULL.
NULL is not the same as an empty string, zero, or the word "unknown". It means the value is absent.
This matters because normal comparisons do not work the way beginners often expect:
WHERE department = NULLThat does not find missing departments. To test for missing values, use IS NULL:
WHERE department IS NULLTo find rows where a value is present, use IS NOT NULL.
You will see NULL again in later lessons. A LEFT JOIN uses NULL when there is no matching row. Aggregates like SUM and AVG usually ignore NULL values. Advanced subtotal queries can also use NULL to mark totals.
This lesson is theory-focused. Read it, then mark it complete in the Learn SQL panel before moving on.
Open this lesson in the SQL editorLessons in Understanding Data
Build the mental model behind SQL: how tables store rows and columns, why data types matter, and how missing values work with NULL.
Related guides
What Is a Database Table? Rows, Columns, and the Mental Model Behind SQL
Before SQL feels natural, you need one simple mental model: tables are structured collections of records with predictable columns.
SQL Data Types Explained: Text, Numbers, Dates, and Better Questions
Data types are the reason SQL knows the difference between a name, a salary, and a hire date — and that difference shapes every query you write.
SQL NULL Explained: How Missing Values Work and Why They Matter
NULL is SQL's way of saying a value is missing or unknown — and it behaves differently from almost every other value beginners expect.