For example, Search all records un colors table where name is start with “Gr”.

You can see the above query matches records with any cases. But, sometimes you need to select case-sensitive data only. In that case, You need to cast the values as binary. To do this add BINARY option with like statment and view the results:

You can see the result contains only those records, which matches extactly with case-sensitive. When we use BINARY, then mysql compare data byte-by-byte. Without BINARY it compares data character-by-character.

MySQL case sensitive Search with LIKE   TecAdmin - 8MySQL case sensitive Search with LIKE   TecAdmin - 64


title: “Mysql Case Sensitive Search With Like Tecadmin” ShowToc: true date: “2022-12-22” author: “Grace Buzzelli”


For example, Search all records un colors table where name is start with “Gr”.

You can see the above query matches records with any cases. But, sometimes you need to select case-sensitive data only. In that case, You need to cast the values as binary. To do this add BINARY option with like statment and view the results:

You can see the result contains only those records, which matches extactly with case-sensitive. When we use BINARY, then mysql compare data byte-by-byte. Without BINARY it compares data character-by-character.

MySQL case sensitive Search with LIKE   TecAdmin - 64MySQL case sensitive Search with LIKE   TecAdmin - 1