Collation Implementation Types mysql>  CREATE TABLE t1 (c1 VARCHAR(2) CHARACTER SET sjis COLLATE sjis_japanese_ci); Query OK, 0 rows affected (0.01 sec) mysql>  INSERT INTO t1 VALUES (’a’),(’A’),(0x82C0); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql>  SELECT c1, HEX(c1), HEX(WEIGHT_STRING(c1)) FROM t1; mysql>  SET NAMES ’latin1’ COLLATE ’latin1_swedish_ci’; Query OK, 0 rows affected (0.01 sec) mysql>  SELECT HEX(WEIGHT_STRING(’a’)), HEX(WEIGHT_STRING(’A’)); +-------------------------+-------------------------+ | HEX(WEIGHT_STRING(’a’)) | HEX(WEIGHT_STRING(’A’)) | +-------------------------+-------------------------+ | 41 | 41 | +-------------------------+-------------------------+ 1 row in set (0.01 sec) mysql>  SELECT ’a’ = ’A’; +-----------+ | ’a’ = ’A’ | +-----------+ | 1 | +-----------+ 1 row in set (0.12 sec) For implementation instructions, see Section 10.14.3, “Adding a Simple Collation to an 8-Bit Character Set” . This kind of collation is implemented using functions in a C source file that define how to order characters, as described in Section 10.13, “Adding a Character Set” . Complex collations for 8-bit character sets Collations for non-Unicode multibyte character sets •Weights equal character codes.  sjis_japanese_ci  is an example of this kind of collation. The multibyte character  ’ ぢ ’  has a character code of  0x82C0 , and the weight is also  0x82C0 . For this type of collation, 8-bit (single-byte) and multibyte characters are handled differently. For 8-bit characters, character codes map to weights in case-insensitive fashion. (For example, the single-byte characters  ’a’  and  ’A’  both have a weight of  0x41 .) For multibyte characters, there are two types of relationship between character codes and weights: +------+---------+------------------------+ | c1 | HEX(c1) | HEX(WEIGHT_STRING(c1)) | +------+---------+------------------------+ | a | 61 | 41 | | A | 41 | 41 | |  ぢ | 82C0 | 82C0 | +------+---------+------------------------+ 3 rows in set (0.00 sec) •Character codes map one-to-one to weights, but a code is not necessarily equal to the weight. gbk_chinese_ci  is an example of this kind of collation. The multibyte character  ’ 膰 ’  has a character code of  0x81B0  but a weight of  0xC286 . mysql>  CREATE TABLE t1 (c1 VARCHAR(2) CHARACTER SET gbk COLLATE gbk_chinese_ci); Query OK, 0 rows affected (0.33 sec) 1993