SQL: Wildcard Operators



SQL wildcards can substitute for one or more characters when searching for data in a database.SQL wildcards must be used with the SQL LIKE operator which is used to compare a value to similar values using wildcard operators.

Two wildcard Operators in SQL are as under:

The percent sign (%):
It matches one or more characters. Note that MS Access uses the asterisk (*) wildcard character instead of the percent sign (%) wildcard character.

Example:
               SELECT * FROM table_name
               WHERE column LIKE 'ABC%'

The underscore (_): It matches one character. Note that MS Access uses a question mark (?) instead of the underscore (_) to match any one character.

Example:
               SELECT * FROM table_name
               WHERE column LIKE '_ABC'

The percent sign represents zero, one, or multiple characters and the underscore represents a single number or character. The symbols can be used in combinations.
Ebook Download
View all
Learn
View all
F11Research & Development, LLC