MySQL distinction between e and é (e acute) - UNIQUE index
and collation is "utf8_general_ci".
And that's the answer. If you're using utf8_general_ci
(actually it applies to all utf_..._[ci|cs]
) collation then diacritics are bypassed in comarison, thus:
SELECT "e" = "é" AND "O" = "Ó" AND "ä" = "a"
Results in 1
. Indexes also use collation.
If you want to distinguish between ą
and a
then use utf8_bin
collation (keep in mind that it also distinguish between uppercase and lowercase characters).
By the way name and age don't guarantee any uniqueness.
I found that
ALTER TABLE students CHARACTER SET utf8 COLLATE utf8_bin;
did not work for me, as it didn't change the collation of existing columns, as can be seen in the results of this query:
SHOW FULL COLUMNS from students;
However, the following query did the job and converted existing columns to utf8_bin collation:
ALTER TABLE students CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
(notice the "CONVERT TO")