BETWEEN covers a range of values
BETWEEN is a short way of saying 'at least this, and at most that'. You give the low value first and the high value second. Both ends count: BETWEEN 10 AND 20 includes a price of exactly 10 and a price of exactly 20.
A tiny example
In plain English: Show me the titles of the books priced anywhere from 10 to 20.
SELECT title
FROM books
WHERE price BETWEEN 10 AND 20;What comes back
| title |
|---|
| Piranesi |
| Dune |
| Wool |
These are the books priced anywhere from 10 to 20, including exactly 10 or exactly 20.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip