MySQL case sensitive foreign key for textual data
I have ISO 639-2
lang开发者_运维问答uage codes (eng, fre, hin, etc.) in english as primary key in my master table. This column is foreign key in may other tables. Now my issue is even though my master have only lower case values, due to human error some values were added in other tables with language id in mixed cases. Even though there was foreign key, it didn't prevent it from happening.
varchar(3)
. Should I convert it to something else? I am not going to use any like
condition in any of the query, only =
and in
.It happens because collation of collumn is case insensitive - something like latin1_swedish_ci change it to case sensitive collation - latin1_swedish_cs
ALTER TABLE t1 MODIFY col1 VARCHAR(3) CHARACTER SET latin1 COLLATE latin1_swedish_cs;
link text
精彩评论