Loading…
Instead of writing two conditions with AND, you can use BETWEEN to filter a range of values.
SELECT * FROM products
WHERE price >= 10 AND price <= 50;
SELECT * FROM products
WHERE price BETWEEN 10 AND 50;
Both queries do the exact same thing — but BETWEEN is cleaner and easier to read.
| Detail | Explanation |
|---|---|
| Inclusive | BETWEEN 10 AND 50 includes both 10 and 50 |
| Works with text | WHERE name BETWEEN 'A' AND 'M' (alphabetical range) |
| Works with dates | WHERE order_date BETWEEN '2025-01-01' AND '2025-12-31' |
| Order matters | The smaller value must come first |
BETWEEN 50 AND 10 returns nothing — always put the smaller value first!
Find all products with a price between 5 and 100 (inclusive).
Run your query to see results