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 = NULL

That does not find missing departments. To test for missing values, use IS NULL:

WHERE department IS NULL

To 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 editor

Lessons 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.

  1. 01 · Tables, Rows, and Columns
  2. 02 · Data Types
  3. 03 · Missing Values with NULL

Related guides