MySQL Between

 

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.

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published. Required fields are marked *