Using wildcard characters  The underscore (_) wildcard character

Chapter 4: Expressions, Identifiers, and Wildcard Characters

The percent sign (%) wildcard character

Use the % wildcard character to represent any string of zero or more characters. For example, to find all the phone numbers in the authors table that begin with the 415 area code:

select phone
from authors
where phone like "415%"

To find names that have the characters “en” in them (Bennet, Green, McBadden):

select au_lname 
from authors 
where au_lname like "%en%"

Trailing blanks following “%” in a like clause are truncated to a single trailing blank. For example, “%” followed by two spaces matches “X ”(one space); “X  ” (two spaces); “X   ” (three spaces), or any number of trailing spaces.





Copyright © 2005. Sybase Inc. All rights reserved. The underscore (_) wildcard character

View this book as PDF