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

ygc2022 2009-02-17 01:47:05
MySQL建立数据库时的字段的Collation 属性 是指什么?
...全文
1467 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
花如月 2011-03-11
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 acmain_chm 的回复:]

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……
[/Quote]

我看到的是下面的,请问是什么意思?
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)
ACMAIN_CHM 2009-02-21
  • 打赏
  • 举报
回复
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-general

10.1. 常规字符集和校对
字符集是一套符号和编码。校对规则是在字符集内用于比较字符的一套规则。让我们使用一个假想字符集的例子来区别清楚。

trainee 2009-02-21
  • 打赏
  • 举报
回复
collation是用在排序,比较大小上。
每种字符集character set都有一种或以上的排序方法,取默认就可以了
hqaht 2009-02-18
  • 打赏
  • 举报
回复
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与对字符串(在字符集中表达)分类所需的存储器的数量有关。

56,897

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧