How To Use LIKE Operator in SQL

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards used in conjunction with the LIKE operator:

  1. % : The percent sign represents zero, one, or multiple characters.
  2. _ : The underscore represents a single character.

A wildcard character is used to substitute any other character or characters in a string.

The percent sign and the underscore can also be used in combinations. You can also combine any number of conditions using AND or OR operators.

Examples

1. Finds any values that starts with "a"

a%

2. Finds any values that ends with "a"

a%

3. Finds any values that have "word" in any position

%word%

4. Finds any values that have "m" in the second position

_m%

5. Finds any values that starts with "a" and ends with "n"

a%n

Subscribe for Free Updates

Please enable the javascript to submit this form