How to Work with Like Operator in SQL
In this article I am going to explain how to work with like Operator in SQL.
Introduction
In this article I am going to explain how to work with between like in SQL. Like operator is used to find data that match a string pattern called mask. You can use a special character within mask known as wildcard. Wildcard is responsible for determining which value in column satisfy the condition.
We can also use NOT key word before the like keyword.
We use comparison operator with WHERE clause. We use it to find the specific record into result set from table stored in database. It is used to fetch specific row or specific record based on comparison.
Wildcard symbols
Sign of Operator |
Name of Operator |
% |
Matches ant string to zero or more character |
- |
Matches any single character |
[ ] |
Matches a single character listed with in bracket |
[ - ] |
Matches a single character within the given range |
[ ^] |
Matches a single character not listed after the caret |
Example
select * from mcnemp
where name like 'sh%'
|
Output