about 9 years ago
SQL wildcards are used within a table to search for data. Usage of wildcard characters in SQL call for SQL LIKE operator, which enables to hold a comparison between a value and similar values.
Following are the two types of wildcard operators :
The percent sign (%) : Matches one or more characters.
Syntax:
E.g:
1.
Finds any values that start with 500
2.
Finds any values that have 600 in any position.
3.
Finds any values that end with 5.
The underscore (_) : Matches one character.
Syntax:
SELECT FROM table_name
WHERE column LIKE 'XXXX_'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX_'
SELECT FROM table_name
WHERE column LIKE 'XXXX_'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX_'
E.g.
1.
Finds any values in a five-digit number that start with 4 and end with 8.
2.
Finds any values that have 00 in the second and third positions.
0 Comment(s)