Your column data is stored using a character set. In this case, it seems to be utf8.
When you work with these columns (for example, to compare comparisons or ordering), MySQL uses sorting. Each column has a default sort, which it inherits from the default sort in the table.
Indexes have default column sorting baked on them so they can function efficiently.
You can do an equality comparison, which is determined by sorting. For example, in JOIN you can specify
ON (turkish.village_name COLLATE utf8_general_ci) = euro.village_name
or maybe
ON turkish.village_name = (euro.village_name COLLATE utf8_turkish_ci)
This should eliminate your illegal combination of sorts without requiring you to modify the table. This can help you avoid changing the database you are asking for. But be careful, using a COLLATE qualifier can defeat using an index. If you have a large table and you rely on performance indices, this can be useless.
So what happens if you change your tables to change the default sort?
- Your data will not change (unless you change the character set). It's good.
- Any indexes containing sorted columns will be restored.
- Your comparisons and orders are subject to change. I donβt know Turkish, so I canβt say what could break. But, for example, in Spanish, the letters N and C do not match. N precedes in the Spanish comparison, but in general sorting they are considered the same. Perhaps some aspect of the Turkish alphabet works the same way, so your
ORDER BY results will be wrong.
But you can fix this by specifying the COLLATE modifier in your ORDER BY .
ORDER BY (euro.village_name COLLATE utf8_turkish_ci)
source share