Wildcard Operator/Like Operator:
The like operator is used to compare a value to similar values using wildcard operators.
It always use Like operator
| Wildcard | Description | 
|---|---|
| % | zero or more characters | 
| _ | single character | 
| [chars] | ranges of characters to match | 
| [^chars] | Matches only a character NOT specified within the brackets | 
Example 1:-
SELECT *
FROM TB_User
WHERE UserID LIKE 'adm%'
output:- UserID start from adm.
Example 2:-
SELECT *
FROM TB_User
WHERE UserID LIKE '%adm%'
output:- UserID contains adm.
Example 3:-
SELECT *
FROM TB_User
WHERE UserID LIKE '__m%'
output:- UserID 3rd must have 'm'
Example 4:-
SELECT *
FROM UserMaster
WHERE UserID LIKE '[IN]%';
output:- UserID are starting from I and N
Example 5:-
SELECT *
FROM UserMaster
WHERE UserID LIKE '[^IN]%';
output:- UserID are not starting from I and N
 

 
 
 
 

0 Comments