Menu
Coddy logo textTech

Null values

Part of the Fundamentals section of Coddy's SQL journey — lesson 12 of 72.

In the real world, we might have fields with no values. A field with no value is called null.

We can manipulate our query using IS NULL or IS NOT NULL to fetch relevant data

For example the following query will return all of the records where col1 has no value:

SELECT *
FROM table1
WHERE col1 IS NULL
challenge icon

Challenge

Easy

Available tables and columns:

  • <strong>people</strong>: <strong>name</strong>

Fetch all of the unique names without missing values.

Cheat sheet

Use IS NULL and IS NOT NULL to filter records based on missing values:

SELECT *
FROM table1
WHERE col1 IS NULL
SELECT *
FROM table1
WHERE col1 IS NOT NULL

Try it yourself

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals