Comparison operators

Previous Next

In a condition with a comparison operator, the expression to the left of the operator is compared to the expression to the right. The outcome is a truth value: True or False.

=

is equal to

!=

is not equal to

>

is greater than

>=

is greater than or equal to

<

is smaller than

<=

is smaller than or equal to

<>

is not equal to

The != and <> operators are equivalent. They both return True if the expressions evaluate to a different value and False if they evaluate to the same value.

A number value is greater than another number value if it is greater in the mathematical sense. A string value is greater than another string value if it is comes last in alphabetical sort order. A date value is greater than another date/time value if it designates a later date/time.

NULL values

Comparisons with a NULL value evaluate to False, regardless of the mathematical operator.

 

 

See also

SQL conditions