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
12. Logical operators – NOT
Text patterns
To be or NULL to be
A little bit of mathematics
Let's practice

Instruction

Keep up the good work! There is one more logical operator worth mentioning: NOT. Basically speaking, whatever is stated after NOT will be negated:

SELECT *
FROM user
WHERE age NOT BETWEEN 20 AND 30;

In the above example we placed NOT in front of a BETWEEN clause. As a result, we'll get all users except for those aged 20 to 30.

Exercise

Select the vin, brand, and model columns of all cars except for those produced between 1995 and 2005.

Stuck? Here's a hint!

Type:

SELECT
  vin,
  brand,
  model
FROM car
WHERE production_year NOT BETWEEN 1995 AND 2005;