Table of Contents Previous Next


3 The SQL Language : 3.5 Functions and Operators : 3.5.2 Comparison Operators

Comparison operators are available for all data types where this makes sense. All comparison operators are binary operators that return values of type BOOLEAN; expressions like 1 < 2 < 3 are not valid (because there is no < operator to compare a Boolean value with 3).
a BETWEEN x AND y
a >= x AND a <= y
a NOT BETWEEN x AND y
a < x OR a > y
There is no difference between the two respective forms apart from the CPU cycles required to rewrite the first one into the second one internally.
expression IS NULL
expression IS NOT NULL
Do not write expression = NULL because NULL is not "equal to" NULL. (The null value represents an unknown value, and it is not known whether two unknown values are equal.) This behavior conforms to the SQL standard.
Some applications may expect that expression = NULL returns true if expression evaluates to the null value. It is highly recommended that these applications be modified to comply with the SQL standard.

3 The SQL Language : 3.5 Functions and Operators : 3.5.2 Comparison Operators

Table of Contents Previous Next