What is Like operator for and what are wild cards | Eklavya Online

What is Like operator for and what are wild cards

LIKE operator is used to match patterns. A “%” sign is used to define the pattern.

Below SQL statement will return all words with letter “S”

SELECT * FROM pcdsEmployee WHERE EmpName LIKE ‘S%’

Below SQL statement will return all words which end with letter “S”

SELECT * FROM pcdsEmployee WHERE EmpName LIKE ‘%S’

Below SQL statement will return all words having letter “S” in between

SELECT * FROM pcdsEmployee WHERE EmpName LIKE ‘%S%’

 

“_” operator (we can read as “Underscore Operator”). “_” operator is the character defined at that point. In the below sample fired a query Select name from pcdsEmployee where name like ‘_s%’ So all name where second letter is “s” is returned.