Comparison Functions and Operators Overview

Name

Description

>

Greater than operator

>=

Greater than or equal operator

<

Less than operator

<>,!=

Not equal operator

<=

Less than or equal operator

=

Equal operator

<=>

NULL-safe equal operator

BETWEEN … AND …

Whether a value is within a range of values

COALESCE

Return the first non-null value in a list

GREATEST

Return the largest value from a list

IN()

Whether a value is within a set of values

IS

Test a value against a boolean

IS NOT

Test a value against a boolean

IS NOT NULL

NOT NULL value test

IS NULL

NULL value test

ISNULL

NULL value test

INTERVAL

Return the index of the largest threshold that is less than or equal to a value

LIKE

Simple pattern matching

ILIKE

Simple pattern matching. Same as LIKE. But it is not case sensitive.

NOT BETWEEN … AND …

Whether a value is not within a range of values

NOT IN

shorthand for multiple XOR conditions.

LEAST

Return the smallest value

NOT LIKE

Negation of simple pattern matching

Comparison operations result in a value of TRUE, FALSE, or NULL. These operations work for both numbers and strings. Strings are automatically converted to numbers and numbers to strings as necessary.

The following relational comparison operators can be used to compare not only scalar operands, but row operands:

=  >  <  >=  <=  <>  !=