BETWEEN Conditions

Use BETWEEN conditions in subqueries to retrieve values within a range.

The syntax for BETWEEN conditions is as follows:

exprNOT ] BETWEEN start-expr AND end-expr

The BETWEEN condition can evaluate as TRUE, FALSE, or UNKNOWN. Without the NOT keyword, the condition evaluates as TRUE if expr is between start-expr and end-expr. The NOT keyword reverses the meaning of the condition but leaves UNKNOWN unchanged.

The BETWEEN condition is equivalent to a combination of two inequalities:

expr >= start-expr AND expr <= end-expr

A BETWEEN predicate is of the form “A between B and C.” Either “B” or “C” or both “B” and “C” can be subqueries. “A” must be a value expression or column.

Compatibility

The BETWEEN condition is compatible between Sybase IQ and Adaptive Server Enterprise.