BETWEEN
inclusive range test
What changes
- Input
- test value and two bounds
- Output or change
- TRUE/FALSE/UNKNOWN
- Return type
- Boolean
Syntax at a glance
test_expression [ NOT ] BETWEEN begin_expression AND end_expression
Work example
A report needs BETWEEN to define which rows satisfy a compound search condition.
Test a match, a nonmatch, and NULL. Write the expected TRUE, FALSE, or UNKNOWN result before running the filter.
Check your work BETWEEN. The rows kept by BETWEEN are exactly those whose complete condition evaluates to TRUE.
Practice SQL
Open in SQL FlowSELECT Value FROM (VALUES (1), (2), (3), (4)) AS Items(Value) WHERE Value BETWEEN 2 AND 3;
Open Microsoft Learn for full syntax, permissions, and details for your version.