Users Pricing

blog

home / developersection / blogs / wildcards operators in sql

Wildcards Operators in SQL

Chris Anderson 4521 30 Nov 2011 Updated 18 Sep 2014

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.


hi I am software developer at mindstick software pvt. ltd.


2 Comments