Coginiti menu Coginiti menu

SQL Between

What is the BETWEEN Operator in SQL?

The SQL BETWEEN operator is used in the WHERE clause of a SQL query to specify a range of values to be returned.

Here’s an example of using the BETWEEN operator in a SQL query:

FROM table 
WHERE price BETWEEN 50 AND 100;

In this example, the query retrieves all columns and rows from the table where the price is between 50 and 100. The BETWEEN operator specifies the range of values that the price column must fall within in order to be included in the result set.

If the values are text, BETWEEN can filter within the alphabetical range.

FROM table 

In this statement, the result would only include names that begin with the letter ‘C’ up to, but not including ones that begin with ‘G’. However, it would match a name set as ‘G’, but not ‘Gabriel’.