MySQL Tutorial – Using BETWEEN condition

Using BETWEEN condition

BETWEEN condition is used to retrieve records with in the given range.

The syntax of BETWEEN condition:

SELECT column_name(s)
FROM table_name
Where column_name
BETWEEN value1 AND value2;

Here is our example database table: (employee_record)

[TABLE=3]

We want to select the firstname and lastname of the employees whose age is between 35-50. Issue the following command:

SELECT f_name, l_name
FROM employee_record
Where age
BETWEEN 35 AND 50;

Result:

+--------+---------+
| f_name | l_name  |
+--------+---------+
| Piolo  | Pascual |
+--------+---------+
1 row in set (0.00 sec)
, ,

Post navigation

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.