If a match set is specified, this position in the search pattern can be replaced by the exact number of characters specified in the match set.
Syntax
<match_set> ::= <underscore> | ? | X'1E' | <match_char>
| ([< Ù
<match_char> ::=
any character except %, *, X'1F', underscore, ?, X'1E', (.<match_range> ::= <match_element>-<match_element>
(character range)<match_element> ::=
any character except ) underscoreExplanation
A
LIKE predicate is used to search for character strings that have a certain pattern. Match sets can be used to specify the pattern ( pattern_element).Model table:
Finding all customers whose names consist of six letters and begin with 'P':
SELECT name, city FROM customer
WHERE name LIKE 'P?????'
NAME |
CITY |
Porter |
Los Angeles |
Peters |
Los Angeles |