Lists and ranges: IN and BETWEEN

Stage 2: Filtering · Lesson 7 of 17 · 4 min read · free, interactive

IN (...) is a short way to write many ORs on the same column:

SELECT name, country FROM players WHERE country IN ('VN', 'JP');

BETWEEN a AND b matches a range and includes both ends:

SELECT name, level FROM players WHERE level BETWEEN 7 AND 10;
SELECT id, bought_at FROM purchases WHERE bought_at BETWEEN '2026-11-01' AND '2026-11-30';

Tip: NOT IN and NOT BETWEEN work too. Careful: NOT IN a list that contains NULL matches nothing.

Practice

Each answer runs in your browser and is checked on hidden data.

Previous: AND, OR and NOT · Next: Text patterns with LIKE · All lessons