MySQL BETWEEN Operator
SYNTAX
SELECT * FROM table_name
WHERE COLUMN NAME
BETWEEN begin_expr AND end_expr
Table structure Used for Example explanation
+————-+———-+
| Field | Type |
+————-+———-+
| ID | int(11) |
| Name | char(35) |
| CountryCode | char(3) |
| District | char(20) |
| Population | int(11) |
+————-+———-+
Example for MYSQL Limit
select * from city where population between 300000 and 2700000;
Output of Above Example
+—-+————-+————-+—————+————+
| ID | Name | CountryCode | District | Population |
+—-+————-+————-+—————+————+
| 1 | Kabul | AFG | Kabol | 1780000 |
| 5 | Amsterdam | NLD | Noord-Holland | 731200 |
| 6 | Rotterdam | NLD | Zuid-Holland | 593321 |
| 7 | Haag | NLD | Zuid-Holland | 440900 |
| 35 | Alger | DZA | Alger | 2168000 |
| 36 | Oran | DZA | Oran | 609823 |
| 37 | Constantine | DZA | Constantine | 443727 |
+—-+————-+————-+—————+————+
7 rows in set (0.00 sec)