How and Why use Wild Card Character in SQL?
Wildcard characters are used with the SQL LIKE operator. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
There are two wildcards used in conjunction with the LIKE operator:
- % - The percent sign represents zero, one, or multiple characters
Queries&Examples
The following SQL statement selects all Users_tb with a FirstName starting with "Ta%":
1.
SELECT * FROM Users_tb
WHERE FirstName LIKE 'Ta%';
The following SQL statement selects all Users_Tbl with a EmailAddress starting with "a", To “F”:
2.
Select* From users_tbl
Where EmailAddress Like ‘[A-F]%’
3.
SELECT * FROM Users_tbl
WHERE EmailAddress Not LIKE '[!bsp]%';
Share This with your friend by choosing any social account