Summary - WHERE filtering
- SQL course
- Beginner
- Lesson 12/115
- 5 min
Combine comparison, logical and pattern operators to filter rows.
Summary - WHERE filtering
In this group you learned WHERE filtering: comparison operators, AND/OR, IN/BETWEEN and LIKE patterns. Now you will combine these in one query.
SELECT name, price
FROM products
WHERE category = 'kitap' AND price < 50;This returns products whose category is book and price is below 50.
name, price is selected from products. WHERE keeps only the rows where category = 'kitap' AND price < 50 holds.
Practice Summary - WHERE filtering
Select name and price from products where category is 'book' AND price is less than 50.
Starter code
-- join two conditions with AND
SELECT name, price
FROM products
WHERESample solution
SELECT name, price
FROM products
WHERE category = 'kitap' AND price < 50Expected output
name price Roman 30 Şiir 18
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which operator needs at least one condition?
- AND
- LIKE
- NOT
- OR Correct answer
Explanation: OR needs at least one.
2 Summary - WHERE filtering: match the terms
| Term | Meaning |
|---|---|
IN |
list |
BETWEEN |
range |
LIKE |
pattern |
AND |
combine |