This topic describes the comparison operators supported by PolarDB-X.

Comparison operators are frequently used in conditional SELECT statements. Comparison operators allow you to determine which records in a table meet the requirements. If the result of a comparison is true, 1 is returned. If the result is false, 0 is returned. If the result is uncertain, NULL is returned.

PolarDB-X supports the following comparison operators.

Operator Description
= Tests whether a value is equal to another value.
<>, != Tests whether a value is not equal to another value.
> Tests whether a value is greater than another value.
< Tests whether a value is less than another value.
<= Tests whether a value is not greater than another value.
>= Tests whether a value is not less than another value.
BETWEEN Tests whether a value lies between two values.

>=min&&<=max

NOT BETWEEN Tests whether a value does not lie between two values.
IN Tests whether a value is in a set.
NOT IN Tests whether a value is not in a set.
<=> Tests whether two values are equal. The operands can be NULL.
Note If both operands are NULL, 1 is returned. If one operand is NULL, 0 is returned.
LIKE This operator is used for fuzzy matching.
REGEXP or RLIKE This operator is used for matching that is based on regular expressions.
IS NULL Tests whether a value is NULL.
IS NOT NULL Tests whether a value is not NULL.