The BETWEEN operator checks whether a value falls within a specified range. The lower and upper boundary values are normally included.
Range-based filtering is common when analyzing salaries, sales amounts, dates, ages, and other measurable values.
Find employees whose salaries are between ₹50,000 and ₹80,000.
SELECT
EmployeeName,
Salary
FROM Employees
WHERE Salary BETWEEN 50000 AND 80000;
BETWEEN is useful for financial ranges, date ranges, price analysis, salary analysis, and business thresholds.
- BETWEEN checks a range.
- The lower boundary is included.
- The upper boundary is included.
- It can be used with numbers and dates.
- NOT BETWEEN can exclude a range.
Is BETWEEN inclusive in SQL?
Yes. BETWEEN normally includes both the lower and upper boundary values.
Can BETWEEN be used with dates?
Yes. BETWEEN can be used to filter date values within a specified range.