Home > DeveloperSection > Blogs > Wildcards Operators in SQL

Wildcards Operators in SQL


Database Database 
Ratings:
1 Comment(s)
 2503  View(s)
Rate this:

Wildcards Operators in SQL

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:

1)      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%'

2)      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.


help me

By aken H on   4 years ago

Don't want to miss updates? Please click the below button!

Follow MindStick