MySQL collation

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_43193386/article/details/100563927

Common collation as follows:

1. utf8_general_ci: case-insensitive,
2. utf8_general_cs: case sensitive
3.utf8_bin: the binary data string for each string in compiling storage case sensitive, and can be stored binary contents.
4.:, utf8_unicode_ci: collation only partially support Unicode collation algorithm, some characters still can not support; utf8_unicode_ci not fully support the combination of the mark.
Description: ci is case insensitive, i.e., "case-insensitive", a and A may be the same as in the character judgment. bin is binary, a and A will not be treated differently. For example, you run: SELECT * FROM table WHERE txt = 'a', then you can not find utf8_bin txt = 'A' of the line, and can utf8_general_ci. utf8_general_ci is a legacy collation, do not support the expansion, it is possible to carry out a comparison between the characters one by one only. This means that compare the speed utf8_general_ci collation carried out quickly, but compared with utf8_unicode_ci collation, comparison of the correctness of the poor.

Differences in application

1. For a language only when bad use utf8_unicode_ci sorting to do, before the implementation of the character set utf8 collation associated with a particular language. For example, with German and French, good utf8_unicode_ci work, we are eliminating the need to create special utf8 collations for these two languages.
2.utf8_general_ci also applies to the German and French, in addition to '?' Equals 's', rather than 'ss' outside. If you can accept these applications, you should use utf8_general_ci, because of its fast speed. Otherwise, use utf8_unicode_ci, because it is more accurate.

use

utf8_unicode_ci more accurate, utf8_general_ci faster. Typically, when a new database is generally used utf8_general_ci. Figure navicat can use to view the collation.

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/qq_43193386/article/details/100563927