strawquery PT
All lessons

Lesson 11 of 30

Missing values

Today at the studio

Some episodes have not aired yet, so nobody knows their viewers. Some shows are still in production and have no premiere year. Kou left a note: "NULL is not zero. NULL is not empty. NULL is NULL. Don't ask."

The idea

NULL means "no value" or "unknown". It is not zero and it is not an empty text. Any comparison with NULL, even NULL = NULL, is neither true nor false, so WHERE x = NULL never matches anything.

Use IS NULL to find missing values and IS NOT NULL to find the rest.

Example

SELECT name FROM departments WHERE floor IS NOT NULL

Your turn

0 of 4 questions

Question 1 of 4

Which shows have no premiere_year yet? Show title.

Unofficial fan project. Titles belong to their creators and rights holders.