What does collation mean?

前端 未结 9 1579
执笔经年
执笔经年 2020-12-04 10:18

What does collation mean in SQL, and what does it do?

9条回答
  •  盖世英雄少女心
    2020-12-04 11:07

    Besides the "accented letters are sorted differently than unaccented ones" in some Western European languages, you must take into account the groups of letters, which sometimes are sorted differently, also.

    Traditionally, in Spanish, "ch" was considered a letter in its own right, same with "ll" (both of which represent a single phoneme), so a list would get sorted like this:

    • caballo
    • cinco
    • coche
    • charco
    • chocolate
    • chueco
    • dado
    • (...)
    • lámpara
    • luego
    • llanta
    • lluvia
    • madera

    Notice all the words starting with single c go together, except words starting with ch which go after them, same with ll-starting words which go after all the words starting with a single l. This is the ordering you'll see in old dictionaries and encyclopedias, sometimes even today by very conservative organizations.

    The Royal Academy of the Language changed this to make it easier for Spanish to be accomodated in the computing world. Nevertheless, ñ is still considered a different letter than n and goes after it, and before o. So this is a correctly ordered list:

    • Namibia
    • número
    • ñandú
    • ñú
    • obra
    • ojo

    By selecting the correct collation, you get all this done for you, automatically :-)

提交回复
热议问题