Best SQL LIKE Operator in 2023

The SQL LIKE Operator

The SQL LIKE operator is used to look for a certain or specified pattern in a column. The LIKE operator allows you to perform wildcard searches, which means you can search for partial matches, not just exact matches.

Examples of SQL LIKE Operator

Example 1: Basic Pattern Matching
SQL> SELECT * FROM Employees
WHERE LastName LIKE ‘S%’;

NOTE: LIKE ‘S%’ matches all rows where the “LastName” starts with ‘S’.

Example 2: Pattern Matching Any Character
SQL> SELECT * FROM Employees
WHERE LastName LIKE ‘_a%’;

NOTE: LIKE ‘_a%’ matches all rows where the “LastName” has ‘a’ as the second character.

Example 3: Pattern Matching Any Character(s) at the End
SQL> SELECT * FROM Employees
WHERE LastName LIKE ‘%son’;

NOTE: LIKE ‘%son’ matches all rows where the “LastName” ends with ‘son.’

Example 4: Case-Insensitive Pattern Matching
SQL> SELECT * FROM Employees
WHERE LastName ILIKE ‘%smith%’;

NOTE: ILIKE ‘%smith%’ matches all rows where the “LastName” contains ‘smith’ regardless of case.

Example 5: Escaping Wildcards
SQL> SELECT * FROM Employees
WHERE LastName LIKE ‘%\%’;

NOTE: LIKE ‘%\%’ matches all rows where the “LastName” contains a literal ‘%’ character.

The above examples shown how to use the LIKE operator in SQL to carry out pattern matching and look for data in a column that matches particular criteria.


In your database, the LIKE operator is a potent tool for flexible and limited text searches.

Leave a Comment