What is the difference between charset and collation in database?

22

Every time I create a database, I always come across these definitions and I do not really know the difference.

I understand what is charset , but not collation .

    
asked by anonymous 26.08.2014 / 16:16

2 answers

17

Charset

Charset defines the character set that you will use to store data as text, where each character receives a number. A very common example is the ASCII table that has only 256 characters. If you indicate that the charset of your system is ASCII, this means that your system will only recognize the 256 characters contained in it. So sometimes we see texts without stress on the internet, with a question mark in place of the character, because the charset of the page does not contain the character that should be displayed. Currently, the default charset is UTF-8, which enables up to 1,114,112 characters, allowing you to display characters in any language, including Chinese and Japanese.

Collation

Collation is the term used to define the set of rules that the server will use for sorting and comparing texts, that is, how will the operators =, & gt ;,

13.03.2017 / 18:40
16
  

Charset is the symbol set and encodes

     

Suppose you have the letters "A", "B", "a" and "b". For each   letter "A" = 0, "B" = 1, "a" = 2 and "b" = 3.   letter "A" is a symbol and 0 is the encode for "A". The combination of   symbol

26.08.2014 / 16:29