How do you force mysql LIKE to be case sensitive?

Bohemian picture Bohemian · Dec 23, 2012 · Viewed 58.4k times · Source

Possible Duplicate:
Mysql Like Case Sensitive

Mysql ignores case for its LIKE comparisons.

How can you force it to perform case-sensitive LIKE comparisons?

Answer

Bohemian picture Bohemian · Dec 23, 2012

Use LIKE BINARY:

mysql> SELECT 'abc' LIKE 'ABC';
    -> 1
mysql> SELECT 'abc' LIKE BINARY 'ABC';
    -> 0