By : Dhirendra Chauhan
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 ( _ )
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%” ;
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_ _ _” ;
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_” ;
THANK
YOU

V15 like operator-c

  • 1.
  • 2.
    LIKE Operator The LIKEoperator 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%” ;
  • 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_ _ _” ;
  • 8.
    Combination Of bothOperator 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_” ;
  • 10.