Beginner

361. BETWEEN Operator

Learn how to filter values within a specified range.

📘 Lesson 361 of 728 ⏱ 9 min 🎯 Beginner

The BETWEEN operator checks whether a value falls within a specified range. The boundary values are normally included.

BETWEEN makes range-based filtering easier to read and is useful for salaries, dates, prices, scores, and transaction amounts.

Find employees whose salaries are between ₹50,000 and ₹80,000.

SQL
SELECT
    EmployeeName,
    Salary
FROM Employees
WHERE Salary BETWEEN 50000 AND 80000;

Analysts use BETWEEN for salary bands, transaction ranges, sales periods, pricing analysis, and date-based reporting.

  • BETWEEN filters values within 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.
Are BETWEEN boundaries included?

Yes. BETWEEN normally includes both the lower and upper boundary values.

Can BETWEEN be used with dates?

Yes. BETWEEN can be used for date and datetime filtering, with care around time components.

Have you finished this lesson?

Introduction to SQL – All Lessons