How can I make SQL case sensitive string comparison on MySQL?

StevenB picture StevenB · Apr 12, 2011 · Viewed 259.1k times · Source

I have a function that returns five characters with mixed case. If I do a query on this string it will return the value regardless of case.

How can I make MySQL string queries case sensitive?

Answer

Craig White picture Craig White · Apr 12, 2011

The good news is that if you need to make a case-sensitive query, it is very easy to do:

SELECT *  FROM `table` WHERE BINARY `column` = 'value'