How to use LIKE clause to do Case-Insensitive Search in a Column In MySQL
The LIKE clause and wildcards in MySQL are powerful tools used in the WHERE clause of a SELECT, UPDATE, or DELETE statement to filter results. It allows you to search for a specified pattern within a column.
Example:
SELECT * FROM Users WHERE name LIKE 'john';
This query will return all customers whose name is “john”. Since it is a case-insensitive search, the query returns multiple rows.
| name |
|------|
| John |
| john |
| joHn |
| JOHN |
How to do Case Sensitive and Case Insensitive Search in a Column in MySQL
LIKE Clause is used to perform case-insensitive searches in a column in MySQL and the COLLATE clause is used to perform case-sensitive searches in a column in MySQL.
Learning both these techniques is important to understand search operations in MySQL. Case sensitivity can affect search queries in MySQL so knowing when to perform a specific type of search becomes very important. This article explains how to search with the LIKE operator and COLLATE() clause with examples.
Contact Us