Is the `AND` used in `BETWEEN` the same as the `AND` operator between conditions?


#1

Question

Is the AND used in BETWEEN the same as the AND operator used between multiple conditions?

Answer

No, although they may be assumed to be the same thing, the AND used with a BETWEEN, like

BETWEEN 1990 AND 1999

is not quite the same AND used when combining multiple conditions. When used in a BETWEEN statement, we are not combining two separate conditions, but providing a range of values to obtain the values within that range.

However, we can easily rewrite a BETWEEN to one with two conditions, like these queries which would be identical.

SELECT *
FROM movies
WHERE year BETWEEN 1990 AND 1999;

SELECT * 
FROM movies
WHERE year >= 1990
AND year <= 1999;