O'Reilly logo

Joe Celko's SQL for Smarties, 5th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 21

LIKE and SIMILAR TO Predicates

Abstract

String matching is done with two built-in functions.

Keywords

ESCAPE

grep()

ISO/IEC 9945

LIKE

Pattern

POSIX

Regular expression

SIMILAR TO

UNIX

UPPER

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. There are two wild cards allowed in the < pattern > string. They are the ‘%’ and ‘_’ characters. The ‘_’ character represents ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required