Ranges with BETWEEN
From this to that.
Customers often say, I want to spend between fifteen and twenty dollars. You could write price greater than or equal to fifteen, and price less than or equal to twenty. But SQL has a shortcut that reads just like English.

- Spend between $15 and $20
- Two tests would work
- A shortcut that reads like English
BETWEEN
Between takes a low value, the word and, and a high value. It includes both ends. So a book at exactly fifteen, or exactly twenty, would be kept. Run it. Seven books fall in the fifteen to twenty dollar range.
SELECT title, price
FROM books
WHERE price BETWEEN 15 AND 20;โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโ โ title โ price โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโค โ A Short History of Bread โ 19.99 โ โ Running on Empty โ 15.99 โ โ Dragons of Ember Bay โ 17.99 โ โ The Map Maker's Daughter โ 18.99 โ โ Crown of Ash โ 16.99 โ โ Startup Stories โ 19.99 โ โ The Glass Forest โ 18.49 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโ
Ranges of dates
Between works on dates too. In this database, dates are written as year, month, and day, like twenty twenty five, dash twelve, dash zero one. That format sorts correctly, so between works perfectly. Run it. There were one hundred and four orders in December twenty twenty five.
SELECT COUNT(*)
FROM orders
WHERE order_date BETWEEN '2025-12-01' AND '2025-12-31';โโโโโโโโโโโโ โ COUNT(*) โ โโโโโโโโโโโโค โ 104 โ โโโโโโโโโโโโ
Summary
Between is a neat way to ask for a range, including both ends, for numbers or dates. Next, how to search inside text, when you only know part of a word.
Key takeaways- BETWEEN low AND high
- Both ends included
- Works on dates too