2

I am trying to use the LIKE operator in my query as follows:

mysql> select cat_title from category where cat_title like '%Indian%Restaurant%';
+--------------------+
| cat_title          |
+--------------------+
| Indian_Restaurants |
+--------------------+
1 row in set (2.59 sec)

However, since I want to do a case insensitive search, I am trying:

mysql> select cat_title from category where UPPER(cat_title) like UPPER('%Indian%Restaurant%');
Empty set (2.83 sec)

Why is the second query not working?

steve landiss
  • 1,659
  • 2
  • 17
  • 27

1 Answers1

1

Most likely the collation on the cat_title column is case insensitive. Use

... cat_title LIKE '%Indian%Restaurant%' COLLATE utf8_bin

See also

Community
  • 1
  • 1
Micha Wiedenmann
  • 18,825
  • 20
  • 87
  • 132