MySQL BETWEEN

Last Updated: March 12, 2022

Range comparison is done with BETWEEN operator

Get the name and salary of employees where salary is between 80,000 and 90,000

SELECT name, salary
FROM employees
WHERE salary BETWEEN 80000 AND 90000

You can write the equivalent SQL in the following way

SELECT name, salary
FROM employees
WHERE salary >= 80000 AND salary <= 90000

You can use BETWEEN operator with dates also.

Test