Range test operator: BETWEEN
The BETWEEN operator tests a value to see if it occurs in a given range including the endpoints. For example, the expression:
col BETWEEN 10 AND 20
evaluates to True if and only if the value of col is at least 10 but no more than 20. Table 6‑6 shows the result type for using BETWEEN for each operand data type.
Table 6‑6 Result data types for using BETWEEN with various operand types
First operand type
Second operand type
Third operand type
Result type
Boolean
Boolean
Boolean
Boolean
Integer
Integer
Integer
Boolean
Decimal
Decimal
Decimal
Boolean
Double
Double
Double
Boolean
Varchar
Varchar
Varchar
Boolean
Timestamp
Timestamp
Timestamp
Boolean
The BETWEEN operator follows the same rules as the comparison operators.