问题
Possible Duplicate:
Mysql Like Case Sensitive
Mysql ignores case for its LIKE comparisons.
How can you force it to perform case-sensitive LIKE comparisons?
回答1:
Use LIKE BINARY:
mysql> SELECT 'abc' LIKE 'ABC';
-> 1
mysql> SELECT 'abc' LIKE BINARY 'ABC';
-> 0
回答2:
Another alternative is to use COLLATE,
SELECT *
FROM table1
WHERE columnName like 'a%' COLLATE utf8_bin;
- SQLFiddle Demo
来源:https://stackoverflow.com/questions/14007450/how-do-you-force-mysql-like-to-be-case-sensitive