Skip to main content

LIKE Operator

Returns true if str matches pattern with escape.

Syntax

str [ NOT ] like ( pattern [ ESCAPE escape ] )

Returns

BOOLEAN

Arguments

  • str: A STRING expression.

  • pattern: A STRING expression.

  • escape: A single character STRING literal.

A pattern to test against the expression. Pattern strings can contain the following wildcard characters:

  • _ (underscore): Match any single character.

  • % (percent): Match any string of zero or more characters.

The default escape character is the \ \. If an escape character precedes a special symbol or another escape character, the following character is matched literally. It is invalid to escape any other character.

Examples

> SELECT 'CeloSQL' like '%eloSQL'
true

> SELECT 'CeloSQL' like 'Celo%'
true

> SELECT 'CeloSQL' like '%abc%'
false

> SELECT 'CeloSQL' not like '%lo%'
false

> SELECT 'CeloSQL' like ('_eloSQL')
true

> SELECT 'CeloSQL' like ('_SQL')
false