Reputation: 1191
My MySQL table has 2 columns, word1 and word2 (both case insensitive and collation utf8_bin).
Word1 can be 'basketball or 'Basketball' or 'BASKETBALL'.
(basketball, game) AND (BASKETBALL, game) both exist as rows in the table.
I use a unique index on word1, word2 to prevent duplicate rows from being inserted, for example, the row (basketball, game) exists, so inserting (basketball, game) into the table is rejected.
The problem is that SELECT is case sensitive and removing 'utf8_bin' collation gives a duplicate entries error.
How do I get SELECT to match case insensitive both 'basketball' and 'BASKETBALL' rows?
Upvotes: 0
Views: 185
Reputation: 111259
You can specify a collation to use with the COLLATE keyword, for example
select * from mytable where word1 = 'baseball' collate utf8_general_ci
Upvotes: 1