WHERE decides which rows you get.
Direct answer
WHERE filters rows using conditions. Combine conditions with AND and OR, test lists with IN, ranges with BETWEEN and text patterns with LIKE. Use IS NULL for missing values.
Examples
SELECT * FROM orders WHERE total > 100;
SELECT * FROM customers
WHERE city = 'Lagos' AND active = 1;
SELECT * FROM products WHERE category IN ('books', 'games');
SELECT * FROM orders
WHERE created_at BETWEEN '2026-01-01' AND '2026-01-31';
SELECT * FROM customers WHERE name LIKE 'A%';
SELECT * FROM customers WHERE phone IS NULL;
Operators
| Operator | Meaning |
|---|---|
=, <> | equal, not equal |
>, <, >=, <= | comparisons |
AND, OR, NOT | combine conditions |
IN | matches a list |
LIKE | text pattern |
Common mistakes
- Using
= NULLinstead ofIS NULL. - Mixing
ANDandORwithout brackets. - Forgetting quotes around text.
Where Teyro fits
Teyro's SQL and Databases for Beginners course turns this into short lessons you can play in a few minutes a day. It has 50 lessons, and you can start free.
The bottom line
Filter early, use brackets for clarity and test with small queries.



