The BETWEEN operator is a shorthand for checking whether a value falls within a range, without writing two separate comparisons joined by AND. Instead of salary >= 70000 AND salary <= 90000, you can write salary BETWEEN 70000 AND 90000 — same result, less typing, and arguably easier to read at a glance.

Basic Syntax

SELECT name, salary
FROM employees
WHERE salary BETWEEN 70000 AND 90000;

Result:

name | salary
--------------|--------
Marco Diaz | 72000.00
Priya Nair | 88000.00

BETWEEN Is Inclusive

A detail worth remembering: BETWEEN includes both boundary values. salary BETWEEN 70000 AND 90000 matches a salary of exactly 70000 or exactly 90000, not just values strictly in between. If you need an exclusive range, you have to write it manually:

-- Inclusive (includes 70000 and 90000 themselves)
WHERE salary BETWEEN 70000 AND 90000

-- Exclusive — BETWEEN has no built-in way to express this
WHERE salary > 70000 AND salary < 90000

Using BETWEEN with Dates

BETWEEN is especially common for filtering date ranges — a report for "all hires in 2023," for example:

SELECT name, hire_date
FROM employees
WHERE hire_date BETWEEN '2023-01-01' AND '2023-12-31';

Result:

name | hire_date
--------------|------------
Alice Chen | 2023-03-14

One subtlety with dates: if the hire_date column actually stores a timestamp (date + time) rather than just a date, BETWEEN '2023-01-01' AND '2023-12-31' can silently exclude rows from the last day of the year, because '2023-12-31' with no time attached is treated as midnight — before any timestamp later that same day. For timestamp columns, it's safer to write the upper bound as '2024-01-01' and use a strict less-than comparison instead of BETWEEN.

Negating with NOT BETWEEN

-- Everyone outside the 70k-90k range
SELECT name, salary
FROM employees
WHERE salary NOT BETWEEN 70000 AND 90000;

BETWEEN is really just readable sugar over a range check with AND — knowing both forms means you can reach for whichever one makes a given query clearest, and recognize BETWEEN instantly when you see it in someone else's code.