Chapter 12. LIKE Predicate

THE LIKE PREDICATE IS a string pattern-matching test with the syntax:

<like predicate> ::=
    <match value> [NOT] LIKE <pattern>
        [ESCAPE <escape character>]

<match value> ::= <character value expression>
<pattern> ::= <character value expression>
<escape character> ::= <character value expression>

The expression M NOT LIKE P is equivalent to NOT (M LIKE P), which follows the usual syntax pattern in SQL. Two wildcards are allowed in the <pattern> string. They are the ‘%’ and ‘_’ characters. The ‘_’ character represents a single arbitrary character; the ‘%’ character represents an arbitrary substring, possibly of length zero. Notice that there is no way to represent zero or one arbitrary character. This is not the case ...

Get Joe Celko's SQL for Smarties, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.