Range with BETWEEN
Oftentimes, we'll want to be specific about the data we extract. For example, instead of getting an entire week's weather, you just want the weather on Wednesday.
This is possible using the WHERE
clause. What if you wanted to know Wednesday's weather from 12:00 PM
to 06:00 PM
? In this case, you've successfully defined a range for your extracted data.
The BETWEEN
operator is used to perform an operation for a specified range. The correct syntax to use this operator is attached. If you look at the query, you will notice that to apply the BETWEEN
statement, we have applied the SELECT/ FROM
and WHERE
statements first.
Here, the statement
is any condition or column name on which we want to define a range. To use the BETWEEN
statement, the SELECT/ FROM
and WHERE
statements are mandatory.
xxxxxxxxxx
SELECT columnName From tableName WHERE statement
BETWEEN value1 AND value2