The SQL BETWEEN Operator in Where Condition

The SQL BETWEEN Operator in Where Condition

Instructor-svgAl-Mamun Sarkar
Apr 15 , 2020

The SQL BETWEEN Operator in Where Condition. Here I show you how to use the BETWEEN Operator for making a condition on SQL Query. 

 

SQL BETWEEN Operator Syntax:

SELECT column, column, .....
FROM table_name
WHERE column BETWEEN value AND value; 

Example:

SELECT * FROM employees
WHERE salary BETWEEN 2000 AND 5000;

With NOT: 

SELECT * FROM employees
WHERE salary NOT BETWEEN 2000 AND 5000;

With the Date Column:

SELECT * FROM employees
WHERE joining_date BETWEEN '2019-01-01' AND '2019-12-30';

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram