LIKE operatorWHERE clause with the LIKE operator
WHERE match_expression [NOT] LIKE pattern
| Symbol | Description |
|---|---|
| % | Matches any string of zero or more characters. |
| _ | Matches any single character. |
WHERE clauses that use the LIKE operator| Example | Results that match the mask |
|---|---|
| WHERE productName LIKE 'Fender%' | All rows that have a name that starts with "Fender". For example, "Fender Stratocaster" and "Fender Precision". |
| WHERE productName LIKE '%cast%' | |
| WHERE zipCode LIKE '076__' | All rows that have a zip code that begins with 076, followed by any two characters. For example, "07652" and "07677", but not 07652-4455. |
| WHERE orderDate LIKE '2017-06-__%' | All rows that have an order date in June of 2017. |
LIKE operator to retrieve rows that match a string pattern, called a mask. Within the mask, you can use special characters, called wildcard characters, that determine which values in the column satisfy the condition.NOT operator before the LIKE operator. Then, only those rows with values that don’t match the string pattern are included in the result set.