3

I have a case-sensitive colume(utf8_bin collation). I need to search a string case-insensitively and order the results case-insensitively.

Is have written this query.

SELECT customer_name 
   FROM customers
   WHERE CONVERT(customer_name USING UTF8) LIKE 'aB%' 
   ORDER BY CONVERT(customer_name USING UTF8) 
   LIMIT 0,10

Is this efficient? Or is there a better way to achieve this?

SatheeshJM
  • 3,575
  • 8
  • 37
  • 60

1 Answers1

3

What about converting in uppercase?

SELECT customer_name 
   FROM customers
   WHERE UPPER(customer_name) LIKE 'AB%' 
   ORDER BY UPPER(customer_name) 
   LIMIT 0,10
TheEwook
  • 11,037
  • 6
  • 36
  • 55