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

Instruction

In every row, there can be NULL values – unknown missing values. Remember the Opel from our table with its missing price? That missing price is represented with a NULL value.

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

SELECT
  Id
FROM User
WHERE MiddleName IS NOT NULL;

This code selects only those users who have a middle name (i.e., that user's MiddleName column has a known value).

Exercise

Select all cars that have a price.

Stuck? Here's a hint!

Type:

SELECT
  *
FROM Car
WHERE Price IS NOT NULL;