bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL BETWEEN Operator

The SQL BETWEEN Operator

The BETWEEN

operator is used in the WHERE clause to select values within a specified range.

The range is inclusive

  • the beginning and end values of the range are included in the results. The values can be numbers, text, or dates.

Example

Select all products with a price between 10 and 20:

SELECT * FROM Products
WHERE Price BETWEEN 10 AND 20;

Syntax

Select

column_name(s)

From

table_name

Where

column_name

Between

value1

And

value2;

Demo Database

Below is a selection from the

Products table used in the examples:

ProductID

ProductName

SupplierID

CategoryID

Unit

Price

Chais

10 boxes x 20 bags 18.00

Chang

Formula

24 - 12 oz bottles

19.00

Aniseed Syrup

Formula

12 - 550 ml bottles

10.00

Chef Anton's Cajun Seasoning

Formula

48 - 6 oz jars

22.00

Chef Anton's Gumbo Mix

36 boxes 21.35

Not Between

Previous

SQL IN Operator

Next

SQL Aliases