A LIKE pattern ending with % can be used to find text values that start with a specified sequence of characters.
Prefix searches are useful when identifying names, codes, account prefixes, product identifiers, or locations that begin with known text.
Find employees whose names start with 'S'.
SELECT
EmployeeName
FROM Employees
WHERE EmployeeName LIKE 'S%';
It is useful for searching customer names, product codes, branch identifiers, and other text-based business fields.
- The pattern starts with the required characters.
- % allows additional characters after the prefix.
- It is useful for prefix searches.
- LIKE behavior can depend on database collation.
- Indexes may be usable for some prefix searches.
How do you find names starting with S?
Use WHERE EmployeeName LIKE 'S%'.
What does S% mean?
It means the text starts with S followed by zero or more characters.