MySQL建立数据库时的字段的Collation 属性 是指什么?

解决方案 »

  1.   

    SHOW COLLATION [LIKE 'pattern']
    来自SHOW COLLATION的输出包括所有可用的字符集。该语句取一个自选的LIKE子句。该子句的pattern指示哪些整序名称可以匹配。举例说明:mysql> SHOW COLLATION LIKE 'latin1%';
    +-------------------+---------+----+---------+----------+---------+
    | Collation         | Charset | Id | Default | Compiled | Sortlen |
    +-------------------+---------+----+---------+----------+---------+
    | latin1_german1_ci | latin1  |  5 |         |          |       0 |
    | latin1_swedish_ci | latin1  |  8 | Yes     | Yes      |       0 |
    | latin1_danish_ci  | latin1  | 15 |         |          |       0 |
    | latin1_german2_ci | latin1  | 31 |         | Yes      |       2 |
    | latin1_bin        | latin1  | 47 |         | Yes      |       0 |
    | latin1_general_ci | latin1  | 48 |         |          |       0 |
    | latin1_general_cs | latin1  | 49 |         |          |       0 |
    | latin1_spanish_ci | latin1  | 94 |         |          |       0 |
    +-------------------+---------+----+---------+----------+---------+
    Default列指示对于其字符集,整序值是否是默认值。Compiled指示字符集是否被编辑到服务器中。Sortlen与对字符串(在字符集中表达)分类所需的存储器的数量有关。
      

  2.   

    collation是用在排序,比较大小上。
    每种字符集character set都有一种或以上的排序方法,取默认就可以了
      

  3.   

    9.1. Character Sets and Collations in General
    A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set. Let's make the distinction clear with an example of an imaginary character set. 
    http://dev.mysql.com/doc/refman/5.1/zh/charset.html#charset-general10.1. 常规字符集和校对
    字符集是一套符号和编码。校对规则是在字符集内用于比较字符的一套规则。让我们使用一个假想字符集的例子来区别清楚。
      

  4.   


    我看到的是下面的,请问是什么意思?
    mysql> show variables like 'collation_%';
    +----------------------+-----------------+
    | Variable_name        | Value           |
    +----------------------+-----------------+
    | collation_connection | utf8_general_ci |
    | collation_database   | utf8_general_ci |
    | collation_server     | utf8_general_ci |
    +----------------------+-----------------+
    3 rows in set (0.02 sec)