Course Process
BETWEEN Operator in MYSQL
The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates.
The BETWEEN operator is inclusive: begin and end values are included
Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
Query:
SELECT * FROM `employees` where year(hire_date) BETWEEN 1996 AND 1998
Output:
As you can see all the employees who were hired in the year of 1996 to 1998 are displayed
Tester Usage Tips:
- Validate matching records for a date range
- Validate matching records for a sequence of values