Comparison Conditions (Boolean Expressions)

Comparison conditions are often called Boolean expressions because they return a TRUE or FALSE result.

Six kinds of Boolean operators can specify a comparison condition:

  • Relational operators
  • [NOT] BETWEEN AND operators
  • [NOT] IN operators
  • IS [NOT] NULL operators
  • Trigger-type operators
  • [NOT] LIKE or MATCHES operators
Their syntax is summarized in this diagram and explained in the sections that follow.
(explicit id coco001) coco001 (explicit id coco002) coco002 (explicit id coco003) coco003 (explicit id coco004) coco004 (explicit id coco006) coco006 (explicit id coco007) coco007 (explicit id coco008) coco008

Comparison Conditions

{ <Expression>[] <Relational Operator>[] <Expression>[] | <Expression>[] [ NOT ] BETWEEN <Expression>[] AND <Expression>[] | [] <IN Condition>[] | { column | expression } IS [ NOT ] NULL | [] <Trigger-Type Operator> [] | { string | column } [ NOT ] { LIKE | []MATCHES } { string [ ESCAPE 'char' ] | column } }
Element Description Restrictions Syntax
char An ASCII character to be the 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
column Name of a column (or a field of a ROW-type column) whose data value is compared to NULL, to string, or to another column Can be qualified by the identifier, synonym, or alias of a table or view See Column Name
expression An SQL expression that returns a single value Must return a single value Expression
string A string delimited by single ( ' ) or double ( " ) quotation marks Both delimiters must be identical See 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.
Warning: A literal DATE or DATETIME value in a comparison condition should specify 4 digits for the year. When you specify a 4-digit year, the DBCENTURY environment variable has no effect on the result. When you specify a 2-digit year, DBCENTURY can affect how the database server interprets the comparison condition, which might not work as you intended. For more information about DBCENTURY, see the Informix® Guide to SQL: Reference.
1 Informix® extension
6 SPL trigger routines only