SQL BETWEEN Operator

BETWEEN keeps values within a range. It includes both ends, so BETWEEN 4 AND 5 means >= 4 AND <= 5.

Updated December 1, 2026

Syntax

WHERE column BETWEEN low AND high

A range of numbers

Drinks from $4 to $5, inclusive. Mocha at exactly $5.00 is included.

SELECT name, price
FROM drinks
WHERE price BETWEEN 4 AND 5;
Result on the SQL Café sample data (6 rows)
nameprice
Latte4.5
Cappuccino4.25
Mocha5
Cold Brew4.75
Chai Latte4.75
Hot Chocolate4

A range of dates

Orders from July 2 to July 4, 2024.

SELECT id, ordered_on
FROM orders
WHERE ordered_on BETWEEN '2024-07-02' AND '2024-07-04';
Result on the SQL Café sample data (5 rows)
idordered_on
32024-07-02
42024-07-02
52024-07-03
62024-07-03
72024-07-04

NOT BETWEEN

Everything outside the range.

SELECT name, calories
FROM drinks
WHERE calories NOT BETWEEN 100 AND 250;
Result on the SQL Café sample data (5 rows)
namecalories
Espresso5
Mocha290
Cold Brew5
Peppermint Tea0
Hot Chocolate320

Common mistakes

Practice BETWEEN Operator interactively

Write real queries in your browser and get instant feedback in the lesson “IN, BETWEEN, LIKE” (Unit 2). New learners can start free from the first lesson.

Frequently asked questions

Is SQL BETWEEN inclusive?

Yes, in every major database it includes both the low and the high value.

Does BETWEEN work with text?

Yes, it compares alphabetically, but results can surprise you: BETWEEN 'A' AND 'C' excludes “Cappuccino”, because it sorts after “C”.

Related SQL tutorials