SQLite BETWEEN operator

The SQLite BETWEEN operator can be used to check if a value is within a given range. Here is what the syntax looks like:

expression BETWEEN lowerlevel AND upperlevel

The SQLite BETWEEN operator replaces the following syntax:

expression >= lowerlevel AND expression <= upperlevel

Or, in other words, the two lines of SQLite code displayed are equivalent. Below code demonstrates how you could make use of the SQLite BETWEEN operator.

SELECT
    name

FROM
    customers

WHERE
    sales BETWEEN 1000 AND 5000;

Above SQLite SELECT query will return all customer names of customers that have purchased a total invoice value of at least 1000 but no more than 5000.