MySQL Between
MySQL Between
MySQL Between syntax and examples.
MySQL Between syntax
SELECT * FROM table_name
WHERE column BETWEEN val1 AND val2;
Table books
ID | NAME | PRICE |
---|---|---|
1 | book1 | 20.0 |
2 | book2 | 25.0 |
3 | book3 | 15.0 |
4 | book4 | 12.0 |
5 | book5 | 18.0 |
Between example
SELECT * FROM books WHERE price BETWEEN 10 AND 15;
Query Result
ID | NAME | PRICE |
---|---|---|
3 | book3 | 15.0 |
4 | book4 | 12.0 |