Published May 7, 2021Updated Aug 18, 2022
Contribute to Docs
BETWEEN operator selects values, inclusive of beginning and end values, within a given range.
SELECT * FROM table WHERE column BETWEEN value_A AND value_B;
column must exist and
value_B must define a valid range.
BETWEEN works with numbers, text, or date data types.
The following query returns all rows from the
students table with a
gpa between 0 and 2 (exclusive) in ascending order:
SELECT *FROM studentsWHERE gpa BETWEEN 0.0 AND 1.99ORDER BY gpa;
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
Analyze Data with SQLLearn to analyze data with SQL and prepare for technical interviews.
Includes 8 Courses