I’ve a table in MySQL 8 "test" with utf8 encoding
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
AND T.table_schema = "test"
AND T.table_name = "user_login";
with two rows than contain values in column "login" the values
id login
-- ---
1 uu
2 ùù
The select
select *, 'explicit utf8_unicode_ci' used_collation from test where login=_utf8'uu' COLLATE utf8_unicode_ci;
return all the two rows. Why? How can i return only the exact result of the where clause?
2
Answers
Why not use utf8mb4
fiddle
Declare the collation for the column to be
utf8_bin
or some other_bin
. Else, you get "accent insensitive" comparison. MySQL 8 has_as_
collations that also provide accent insensitivity.