Skip to main content
The LIKE is used for pattern matching to find similar strings in data. It’s often employed in the WHERE clause to filter results based on specific patterns. LIKE is case-sensitive; use ILIKE for case-insensitive pattern matching.

Syntax

Parameters

Return Type

BOOLEAN

Example

The following example finds all players whose nickname starts with joe using the % wildcard, which matches any sequence of characters:

Rows: 7Execution time: 2.70ms

LIKE is case-sensitive. The following example returns no results because no nicknames start with uppercase 'Joe':

Rows: 0Execution time: 6.48ms

The _ wildcard matches exactly one character. The following example finds players whose nickname contains oe, followed by any single character, then e:

Rows: 4Execution time: 7.61ms

Example using a non-constant pattern

The pattern doesn’t have to be a literal. You can match each row against a pattern stored in another column. For example, given a filters table that holds one pattern per row, join it with players to return the nicknames that match any of the patterns:
If the pattern column contains joe% and %long, this returns nicknames such as joe12, joemata, and joshualong.