you are at Encyclopedia of SQL >> BETWEEN
BETWEEN
BETWEEN helps us to limit result of query by setting limiting values which can be
numbers, strings or date value
Syntax
SELECT `column_name`
FROM `table_name`
WHERE `column_name`
BETWEEN 'limit1' AND 'limit2'
Example
Show name and surname people between age of 3 and 13 years old.
name | surname | age |
Paweł | Kowalski | 3 |
Piotr | Janik | 7 |
Michał | Nowak | 13 |
query
SELECT `name`,`surname`
FROM `people` WHERE `age`
BETWEEN 3 AND 13
result
In some database servers there are displayed limiting values as a result of query and sometimes
these values aren't taken to display. Please check your database documentation.
[ wróć na górę strony ]