Like
Returns true when the left string matches the SQL LIKE pattern on the right.
Category: comparison
SQL symbol: LIKE
Syntax
sql
<haystack> LIKE <pattern>Parameters
<haystack>— The value tested against the pattern. VARBINARY is accepted as well as text, and is matched as bytes. Acceptsnvarchar,varbinary,varchar.<pattern>— A SQL LIKE pattern:%matches any run of characters including none,_matches exactly one, and every other character matches itself. The whole value must match, not part of it -'abcd' LIKE 'a_c'is false. A column is accepted here, not only a literal; a literal is what lets the planner fuse the match into the scan. Acceptsnvarchar,varbinary,varchar.
Returns
Examples
sql
SELECT name FROM $planets WHERE name LIKE 'Ma%';Mars
sql
SELECT 'abc' LIKE 'a_c', 'abcd' LIKE 'a_c';true | false
Signatures
nvarchar LIKE nvarchar→ booleannvarchar LIKE varbinary→ booleannvarchar LIKE varchar→ booleanvarbinary LIKE nvarchar→ booleanvarbinary LIKE varbinary→ booleanvarbinary LIKE varchar→ booleanvarchar LIKE nvarchar→ booleanvarchar LIKE varbinary→ booleanvarchar LIKE varchar→ boolean
Notes
Matching is case-sensitive; ILIKE is the case-insensitive form. A NULL on either side is not matched.