BETWEEN is an inclusive range predicate for numeric filters.

highlighted = computed this step

Input table

Start with orders that have status labels and amounts.

Orders\text{Orders}
Ordersorder_idstatusamounto1paid120o2pending40o3paid70o4review95

Where query

Filter to rows whose amount is inside the inclusive range.

WHERE amount BETWEEN bounds\text{WHERE amount BETWEEN bounds}
WHERE amount BETWEEN boundswhere betweenarity 3 rows 2Ordersarity 3 rows 4

Predicate truth

Rows on either boundary evaluate to TRUE.

inclusive boundary truth\text{inclusive boundary truth}
Three-valued truthrowtruth1FALSE2FALSE3TRUE4TRUE

Filtered output

Only the in-range amount rows pass the filter.

range-filtered orders\text{range-filtered orders}
Filtered outputorder_idstatusamounto3paid70o4review95