LIKE Operator in SQL
For Complete YouTube Video: Click Here
In this class, we will understand LIKE Operator in SQL.
We have already discussed some of the single value operators.
Table of Contents
LIKE Operator in SQL
LIKE Operator can search through the rows of a database column for values that look like a pattern you describe.
Whenever we don’t know the exact value, we can match the pattern that it looks.
There are two Special Characters to denote which kind of matching to do.
- % Wildcard (Anything is acceptable one character, hundreds of characters or no characters)
- _ Position Maker (Matches only one character)
Pattern Matching Examples
V% A value that starts with V and after that anything is accepted
_ _s% Two characters followed by ‘s,’ and after that, any character is accepted
J%a First character should be J after that any character, and the last character should be a
Ran% First three characters should by Ran after that any number of characters
SQL Example using LIKE
To understand this we will consider the students as shown below.