BETWEEN Operator in SQL helps you select values withing a given range.
Syntax of BETWEEN operator –
SELECT column_name FROM table_name WHERE column_name BETWEEN value1 AND value2
Let’s say that I want to find all the orders where the price of an item is between 5 to 10 dollars.
SELECT * FROM orderitems WHERE item_price BETWEEN 5 AND 10;
And to get all the orders that are not between 5 and 10 dollars
SELECT * FROM orderitems WHERE item_price NOT BETWEEN 5 AND 10;