Ghazanfar Mir
Ghazanfar Mir

Reputation: 3541

Difference between Encoding and collation?

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

Upvotes: 34

Views: 8646

Answers (3)

T.Todua
T.Todua

Reputation: 56555

Excellent answers found here, at programmers.SE:

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

Upvotes: 5

danieljustin
danieljustin

Reputation: 9

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/

Upvotes: 0

Johan
Johan

Reputation: 76753

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

Upvotes: 25

Related Questions