LIKE
Syntax
string_1 [ NOT ] LIKE string_2
Description
Matches the string string_1
to the template string_2
and returns TRUE
on match.
You can specify the value in string_2
or use the %
character to match a string of any length.
The string_1 NOT LIKE
option returns the opposite value.
When comparing values, the function is case-sensitive. You can use LIKE
along with UPPER or LOWER for case-insensitive comparison.
Argument types:
string_1
—String
string_2
—String
Return type: Boolean
Examples
"raspberry" LIKE "%spb%" = TRUE
"raspberry" LIKE "%SPB%" = FALSE
"raspberry" NOT LIKE "%spb%" = FALSE
IF([Country] LIKE 'RU', 'Y', 'N')
IF([Phone] LIKE '+7%', 'RU', 'notRU')
UPPER("raspberry") LIKE "%SPB%" = TRUE
UPPER("West") LIKE "WEST" = TRUE
Data source support
ClickHouse 21.8
, Microsoft SQL Server 2017 (14.0)
, MySQL 5.7
, Oracle Database 12c (12.1)
, PostgreSQL 9.3
, YDB
.