The LIKE operator performs pattern matching on text values. Common wildcard characters include % for zero or more characters and _ for exactly one character in many SQL systems.
Text searches are common when users need records based on partial names, codes, descriptions, or other textual patterns.
Find employees whose names start with the letter S.
SELECT
EmployeeName
FROM Employees
WHERE EmployeeName LIKE 'S%';
LIKE is commonly used for customer searches, employee name searches, product descriptions, address analysis, and data-quality checks.
- LIKE performs pattern matching.
- % represents zero or more characters in common SQL syntax.
- _ represents one character in common SQL syntax.
- LIKE is commonly used with text columns.
- NOT LIKE excludes matching patterns.
What is LIKE used for?
LIKE is used to search text values based on a specified pattern.
What does % mean in a LIKE pattern?
The percent wildcard commonly represents zero or more characters.