SQL Between

SQL Between

The SQL BETWEEN returns records between two values from a select query.

Between syntax

SELECT * FROM table_name WHERE column_name BETWEEN a_value AND b_value;

Between example

Coder books table

IDTitlePriceDescription
1Learn SQL20Learn SQL language
2Learn MySQL22Learn MySQL language
3HTML book17Learn HTML
4Learn PHP20Introduction to PHP
5Learn PHP20PHP course
SELECT * FROM coder_books WHERE price between 10 and 20;

Result

IDTitlePriceDescription
1Learn SQL20Learn SQL language
3HTML book17Learn HTML
4Learn PHP20Introduction to PHP
5Learn PHP20PHP course