Today I was asked an interesting question: "Can we make MySQL to
be case sensitive for SELECT queries and can we force a column in
MySQL to be always lowercase?"
My response was that yes, we can have "instruct" MySQL to be case
sensitive. One way to do that is to set the collation for the
table (or column) to be either binary or case sensitive as shown
below.
The naming convention for collation in mysql is as follows:
*_bin: represents binary case sensitive collation
*_cs: case sensitive collation
*_ci: case insensitive collation
[Read more]
###########
# Start binary collation example
###########
mysql> create table case_bin_test (word VARCHAR(10)) CHARACTER SET latin1 COLLATE latin1_bin;
Query OK, 0 rows affected (0.02 sec)
mysql> INSERT INTO case_bin_test VALUES ('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');
Query OK, 5 rows affected (0.00 …