Show TOC

Syntax documentationBetween predicate Locate this document in the navigation structure

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

Syntax

Syntax Syntax

  1. <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>
    
End of the code.

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

Syntax Syntax

  1. SELECT * FROM a WHERE c BETWEEN 1 AND 100
End of the code.

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.