Wednesday, July 25, 2012

Collation vs Charset in MySQL

I've always been confused by what Collation and Character Set mean in databases and how they are different.

The character set means how data is stored the database. Particularly the encoding used to map characters such as 'a', 'b', etc. to values that are actually stored. Think the ascii table. Examples of character sets are Latin-1, UTF-8, etc.

The collation is how data is compared in the database. i.e. if 'a' and 'A' are same. Examples of collation are  utf8_swedish_ci, utf8_general_ci, etc.

No comments:

Post a Comment