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
13. Join even more conditions
Text patterns
To be or NULL to be
A little bit of mathematics
Let's practice

Instruction

We can include even more conditions by using parentheses, according to our needs. If we want to find only those users who are above 70 years old or below 13 and who are at least 180 cm tall, we can use the following expression:

SELECT
  id,
  name
FROM user
WHERE (age > 70 OR age < 13)
  AND (height >= 180);

Exercise

Select the vin of all cars which were produced before 1999 or after 2005 and whose price is lower than $4,000 or greater than $10,000.

Stuck? Here's a hint!

Type:

SELECT vin
FROM car
WHERE (production_year < 1999
  OR production_year > 2005)
  AND (price <  4000 OR price > 10000);