Today I see this SQL statement, I have heard it before, but I do not understand it, so make a note here:
UserName varchar (COLLATE) chinese_prc_ci_as null
1. First, COLLATE is a clause that can be applied to a database definition or column definition to define a collation, or applied to a string expression to apply a collation projection
:: ={windows_collation_name}| {Sql_collation_name}
Parameter: Collate_name is the name of the collation that is applied to the expression column definition or database definition collation_name can be just the specified windows_collation_name or sql_collation_name
Windows_collation_name: Is the collation name of the Windows collation See Windows collation Name
Sql_collation_name: Is the collation name of the SQL collation see SQL collation Name
2. What is a sort rule?
MS is described in this way: "In Microsoft SQL Server 2000,
The physical storage of a string is specified by the collation control collation to indicate the bit pattern for each character and
The rules used to store and compare characters "
Sql server
SELECT * FROM:: Fn_helpcollations ()
The collation name is composed of two parts,The first half refers to the character set supported by this collation
such as:
Chinese_prc_cs_ai_ws
first half: Refers to the Unicode character set, the chinese_prc_ pointer to the continental simplified Unicode collation
the second half of the collation is the suffix meaning:
_bin binary Ordering
_ci (CS) is case sensitive, CI is not differentiated, CS is distinguished
_ai (AS) are accent-sensitive, AI not differentiated, as differentiated
_ki (KS) Whether the kana type is differentiated, KI does not differentiate, KS differentiates
_wi (WS) Whether the width of the WI is not differentiated, WS
Case Sensitivity: Select this option if you want the comparison to treat uppercase and lowercase letters as unequal
Accent Sensitivity: If you want comparisons to treat accented and non-accented letters as unequal, select this option if you select this option,
The comparison also treats letters with different accents as unequal
Kana distinction: Select this option if you want the comparison to treat katakana and hiragana Japanese syllables as unequal
Width difference: Select this option if you want the comparison to treat half-width characters and full-width characters as unequal
3. There is also a corresponding character collation in MySQL (10.10.MYSQL supported character set in MySQL 5.1 in proofreading)
For example:
Create a user database that uses the UTF8 character set with the proofing rules
create database if not EXISTS user character set UTF8 collate utf8_general_ci;