LIKE

All functions > COMPARISON > LIKE

Returns TRUE if a string matches a specified pattern with wildcards.

Signatures

Returns: TRUE if string matches pattern, FALSE otherwise

LIKE(string: VARCHAR, pattern: VARCHAR, [escape: VARCHAR]) → BOOLEAN
sql
ParameterTypeRequiredDescription
stringVARCHARYesString expression to test
patternVARCHARYesPattern string with wildcards (% for any characters, _ for single character)
escapeVARCHARNoOptional escape character to treat wildcards literally

Notes

  • Uses SQL wildcard pattern matching
  • % matches zero or more characters
  • _ matches exactly one character
  • Case-sensitive matching
  • NULL inputs return NULL
  • Use ESCAPE clause to treat wildcard characters literally
  • Common escape character is backslash ()
  • Can be used with operator syntax: string LIKE pattern

See also

Examples

Basic pattern matching

FeatureQL
SELECT
    f1 := 'hello' LIKE 'h%',  -- Starts with 'h'
    f2 := 'hello' LIKE '%o',  -- Ends with 'o'
    f3 := 'hello' LIKE '%ll%',  -- Contains 'll'
    f4 := 'hello' LIKE 'h_llo',  -- Single character wildcard
    f5 := 'hello' LIKE 'world',  -- No match
    f6 := 'hello' LIKE 'HELLO'  -- Case sensitive
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEANf4 BOOLEANf5 BOOLEANf6 BOOLEAN
TRUETRUETRUETRUEFALSEFALSE

NULL handling

FeatureQL
SELECT
    f1 := NULL::VARCHAR LIKE 'pattern',  -- NULL string
    f2 := 'text' LIKE NULL::VARCHAR  -- NULL pattern
;
Result
f1 BOOLEANf2 BOOLEAN
NULLNULL

Advanced patterns

FeatureQL
SELECT
    f1 := 'file.txt' LIKE '%.txt',  -- File extension
    f2 := '100%' LIKE '100\%'  -- Escaped percent
;
Result
f1 BOOLEANf2 BOOLEAN
TRUETRUE

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19