且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于 MySQL 和 PHP 的***排序规则是什么?

更新时间:2023-02-17 16:19:10

主要区别在于排序准确性(比较语言中的字符时)和性能.唯一特殊的是utf8_bin,用于比较二进制格式的字符.

The main difference is sorting accuracy (when comparing characters in the language) and performance. The only special one is utf8_bin which is for comparing characters in binary format.

utf8_general_ciutf8_unicode_ci 快一些,但不太准确(用于排序).特定语言 utf8 编码(例如 utf8_swedish_ci)包含额外的语言规则,使它们能够最准确地对这些语言进行排序.大多数时候我使用 utf8_unicode_ci(我更喜欢准确性而不是小的性能改进),除非我有充分的理由更喜欢特定语言.

utf8_general_ci is somewhat faster than utf8_unicode_ci, but less accurate (for sorting). The specific language utf8 encoding (such as utf8_swedish_ci) contain additional language rules that make them the most accurate to sort for those languages. Most of the time I use utf8_unicode_ci (I prefer accuracy to small performance improvements), unless I have a good reason to prefer a specific language.

您可以在 MySQL 手册上阅读有关特定 unicode 字符集的更多信息 - http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html

You can read more on specific unicode character sets on the MySQL manual - http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html