MySQL Between

March 31, 20191 min readUpdated 1/19/2021

 

The BETWEEN is used in the WHERE clause to check if a value is in a range.

Here is an example of BETWEEN and AND. We are querying customers that have sales rep with id between 1 and 7.

BETWEEN can also be done by using >= and <=.

Here is an example of BETWEEN with NOT

BETWEEN with Date comparison

It is best practice to convert the value to the DATE datatype before using it with the BETWEEN clause.