2. LIKE Operator
The LIKE operator is used in a WHERE clause to search for a
specified pattern in a column.
The LIKE keyword is used to select rows containing columns
that match a wildcard pattern.
There are two wildcards
1. Percent ( % )
2. Underscore ( _ )
3. Percent ( % )
Syntax:
SELECT * / columnnames
FROM table_name
WHERE columnname
Like “%character%” ;
The percent sign represents multiple characters.
The % character matched any substring.
Example:
SELECT *
FROM Employee
WHERE names
Like “ a%” ;
4.
5.
6. Underscore ( _ )
Syntax:
SELECT * / columnnames
FROM table_name
WHERE columnname
Like “_ character _” ;
The underscore represents a single character.
The _ character matches any character.
Example:
SELECT *
FROM Employee
WHERE names
Like “ s_ _ _” ;
7.
8. Combination Of both Operator
Syntax:
SELECT * / columnnames
FROM table_name
WHERE columnname
Like “%_character_ %”
We can use both operator in MySql Query
Example:
SELECT *
FROM Employee
WHERE names
Like “ _a%a_” ;