Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
See the whole table
Select some columns
Filtering rows
Logic
Text patterns
To be or NULL to be
18. Looking for NOT NULL values
A little bit of mathematics
Let's practice

Instruction

In every row, there can be NULL values, i.e. fields with unknown, missing values. Remember the Opel from our table with its missing price? This is exactly a NULL value. We simply don't know the price.

To check whether a column has a value, we use a special instruction IS NOT NULL.

SELECT id
FROM user
WHERE middle_name IS NOT NULL;

This code selects only those users who have a middle name, i.e., their middle_name column is known.

Exercise

Select all columns for each car whose price column isn't a NULL value.

Stuck? Here's a hint!

Type:

SELECT *
FROM car
WHERE price IS NOT NULL;