Show TOC

Between predicateLocate this document in the navigation structure

The between predicate is used test whether a value is within a given closed value range.

Syntax

<between predicate> ::= <value expression> ( NOT )? BETWEEN <lower bound> AND <upper bound>.

<lower bound> ::= <value expression> 
                            | <dynamic parameter specification>

<upper bound> ::= <value expression> 
                            | <dynamic parameter specification>

            

The data types of the three <value expression> s in a <between predicate> must be comparable.

The <between predicate> "a NOT BETWEEN b AND c" is equivalent to the <boolean factor> "NOT ( a BETWEEN b AND c )".

The <between predicate> "a BETWEEN b AND c" is equivalent to the <boolean term> "a >= b AND a <= c".

Example

SELECT * FROM a WHERE c BETWEEN 1 AND 100
            

BETWEEN PREDICATE. This SELECT yields all rows from table a where the value of the column a.c is greater or equal to 1 and lower or equal to 100.