BETWEEN conditions

The syntax for BETWEEN conditions is as follows:

expr [ NOT ] 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.” In Sybase IQ 12.6 and prior versions, “A”, “B”, and “C” all had to be value expressions or columns.

Now either “B” or “C” or both “B” and “C” can be subqueries. “A” must still be a value expression or column.

Compatibility

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