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.
- % : The percent sign represents zero, one, or more characters.
- _ : 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.
1. Find values that starts with "a"
2. Find values that ends with "a"
3. Find values that have "word" in any position
4. Find values that have "m" in the second position
5. Find values that starts with "a" and ends with "n"