MySQL Crash Course #19# Chapter 27. Globalization and Localization

Globalization and Localization

When discussing multiple languages and characters sets, you will run into the following important terms:

  • Character sets are collections of letters and symbols.

  • Encodings are the internal representations of the members of a character set.

  • Collations are the instructions that dictate how characters are to be compared.

关于字符集和排序规则的几点注意事项:

  • 在常规操作,诸如 SELECT、INSERT 的时候,我们无须担心字符集的问题,因为字符集、排序顺序是在服务器、数据库、表的层次上被设置的。这些东西通常在你安装数据库的时候就已经配置好了。
  • 如果创建表的时候没有指明字符集,数据库将自动给你配置默认的字符集。
  • 甚至可以为指定的列专门设置字符集。
  • 在排序、GROUP BY、使用聚集函数等很多场景都可以指定特定的排序规则(COLLATE )

 几个顾名思义的操作:

-- 显示当前的字符集和排序规则
SHOW VARIABLES LIKE 'character%';
SHOW VARIABLES LIKE 'collation%';
-- 显示所有可用的字符集和排序规则
SHOW CHARACTER SET;
SHOW COLLATION;

猜你喜欢

转载自www.cnblogs.com/xkxf/p/8926843.html