Описание тега sql-like
The LIKE predicate is used to search for a specific pattern in a column.
The LIKE
predicate is used to search for a specified pattern in a column. The wildcard character %
stands for a sequence of zero or more characters, the wildcard character _
stands for a single character.
Examples of usage:
Starts with P
SELECT * FROM Person
WHERE name LIKE 'P%'
Ends with P
WHERE name LIKE '%P'
Contains P
(will match anywhere in the string so this potentially returns a lot of rows)
WHERE name LIKE '%P%'
Has an E
as second character:
WHERE name LIKE '_E%'
You can also combine any other conditions using AND
or OR
operators.
References