When I have discovered MySQL User-defined variables at the first time, I didn’t pay much attention to them and didn’t realize their strength. At first, one can think that they are just one of the many unnoticed MySQL features. Well, I was wrong. Here, I will try to summarize their strength, though I think there is […]
A colleague at work asked me “how can I run a case sensitive select on a case insensitive table?” out of curiosity and for a moment I hesitated, then said, yeah why not :) ….
Below are two different approaches (one of which is quite inefficient) and if anyone has another way, better or worse, please do leave a comment with your suggested approach :).
  Cheers,
  Darren
Preparation
  
  mysql [localhost] {root} (test) > create table t1(a
  varchar(20));
  Query OK, 0 rows affected (0.02 sec)
  mysql [localhost] {root} (test) > insert into t1 (a) values
  ('darren');
  Query OK, 1 row affected (0.00 sec)
  mysql [localhost] {root} (test) > insert into t1 (a) values
  ('Darren');
  Query OK, 1 row affected (0.00 sec)
  mysql [localhost] {root} (test) > insert into t1 (a) values
  ('DarRen');
  Query OK, 1 row affected (0.00 …