Specify a range comparison.

 

Syntax

 

<between predicate> ::=

 

<between predicate part 2> ::=

 

 

 

[ NOT ] BETWEEN <row value predicand> AND <row value predicand>

 

 

Notes

 

The BETWEEN predicate is equal to:



 


value1 >= value2 AND value1 <= value3



 

The degree of the row value predicands shall be 1.



 

The data types shall be comparable.



 

The result of evaluating the predicate is shown in the Truth table for the AND boolean operator.



 

The NOT operator inverts the meaning of the comparison and is equal to:



 


NOT ( <row value predicand> BETWEEN <row value predicand> AND <row value predicand> )



 

 

Examples

 

1)

The following example selects teachers who earn between $30,000 and $35,000:



 


SELECT teacherName, salary


FROM teachers


WHERE salary BETWEEN 30000 AND 35000



 

 


 

Conformance

 

SQL:2003 standard

-

Core SQL