Five kinds of comparison conditions exist: Relational Operator, BETWEEN, IN, IS NULL, and LIKE and MATCHES. Comparison conditions are often called Boolean expressions because they return a TRUE or FALSE result. Their syntax is summarized in this diagram and explained in the sections that follow.
Comparison Conditions: (1) (2) (1) |--+-| Expression |-------| Relational Operator |-------| Expression |--------------------------------------+--| | (1) (1) (1) | +-| Expression |-------+-----+--BETWEEN--| Expression |-------AND--| Expression |------------------------+ | '-NOT-' | | (3) (4) | +--------| IN Condition |--------------------------------------------------------------------------------+ | (5) | +-| Column Name |-------IS--+-----+--NULL----------------------------------------------------------------+ | '-NOT-' | | (6) (6) | '-+-| Quoted String |------+--+-----+--+-LIKE-----------+--+-| Quoted String |-------+---------------+-+-' | (5) | '-NOT-' | (3) | | '-ESCAPE 'char'-' | '-| Column Name |--------' '--------MATCHES-' | (5) | '-| Column Name |---------------------------'
Element | Description | Restrictions | Syntax |
---|---|---|---|
char | An ASCII character to be the nondefault escape character
in the quoted string. Single ( ' ) and
double ( " ) quotation marks are not valid as char. |
See ESCAPE with LIKE and ESCAPE with MATCHES. | Quoted String,
p. Quoted String |
The following sections describe the different types of comparison conditions:
For a discussion of comparison conditions in the context of the SELECT statement, see Using a Condition in the WHERE Clause.