Between

SQL BETWEEN

The BETWEEN keyword returns records between two values.

Syntax

SELECT * FROM name_of_table WHERE name_of_column BETWEEN value1 AND value2;

Example

Table of books

ID NAME PRICE
1 Learn Python 45
2 MySQL Tutorial 32
3 PHP examples 24
4 Learn SQL 32
SELECT * FROM books WHERE price BETWEEN 30 AND 45;

Output

ID NAME PRICE
1 Learn Python 45
2 MySQL Tutorial 32
4 Learn SQL 32