Last updated
SQL BETWEEN
Definition: BETWEEN selects values within a range, and it includes both end values. It works with numbers, text, and dates.
Example 1 — prices in a range
SELECT ProductName, Price FROM Products WHERE Price BETWEEN 10 AND 20;
Returns products priced from 10 up to and including 20.
Example 2 — an age range
SELECT * FROM Customers WHERE Age BETWEEN 30 AND 40;
Example 3 — NOT BETWEEN
SELECT ProductName, Price FROM Products WHERE Price NOT BETWEEN 10 AND 20;
💡 Tip: BETWEEN 10 AND 20 is the same as Price >= 10 AND Price <= 20, just easier to read.
Try it Yourself
Output
Ad · responsive