Mysql collate, searching case sensitive

Usually our mysql queries are not case sensitive. In order to query case sensitive, you can use the mysql COLLATE clause.
The collate clause lets you specify a collation, which basically is a set of rules for comparing characters in a given character set.

The suffixes ci, cs, bin of a collation stand for case insensitive, case sensitive and binary, respectively. A binary collation such as utf8_bin is case sensitive as well since it compares the characters based on their numeric values.

SELECT * FROM users WHERE name like 'cRaZy' COLLATE utf8_bin;
Andreas Robecke almost 9 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more