What does the BETWEEN operator do?
BETWEEN is an operator that filters data by a range of values.
It checks whether a value falls between two bounds, inclusive.
Syntax:
sql
WHERE column BETWEEN value1 AND value2Examples:
WHERE age BETWEEN 18 AND 30, selects every row where age is between 18 and 30, inclusive.WHERE date BETWEEN '2025-01-01' AND '2025-12-31', selects every record from the year 2025.
Important:
- It works with numbers, dates, and text.
- The range's bounds are included in the result.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.