Difference between Encoding and collation?

2019-01-18 02:52发布

I have seen certain questions and bugs related to encoding and collation. Could anyone of the visitors explain the difference in MySQL domain?

3条回答
祖国的老花朵
2楼-- · 2019-01-18 03:10

Encoding refers to that character set used.
Collation determines the sort order.

See: http://dev.mysql.com/doc/refman/5.5/en/charset-general.html

查看更多
beautiful°
3楼-- · 2019-01-18 03:11

Excellent answers found here, at programmers.SE:

collation defines the behaviour of comparison operators: =, >, <, <=, >= ...

查看更多
姐就是有狂的资本
4楼-- · 2019-01-18 03:32

I think following qualifies as a better definition for Encoding

Encoding is an algorithm that translates a list of numbers to binary so it can be stored on disk. For example UTF-8 would translate the number sequence 1, 2, 3, 4 like this: “00000001 00000010 00000011 00000100″.

Source: http://www.calipus.com/blog/what-is-the-difference-between-character-sets-encoding-collations/

查看更多
登录 后发表回答