Select, Filter and Sort · Problem 7 of 118

Customers Without a Phone Number

MediumSelect, Filter and SortShop data

Support wants to collect the missing phone numbers.

Return the customer_id, first_name and last_name of every customer whose phone is missing (NULL).

Hint 1

Try phone = NULL first and look at the result. Then read about IS NULL.

Reference solution

SELECT customer_id, first_name, last_name
FROM customers
WHERE phone IS NULL;

NULL means "unknown", and an unknown value is not equal to anything, not even to another NULL. So phone = NULL is never true. Use IS NULL (and IS NOT NULL). Every beginner meets this; every professional checks for it.