Mysql sorted by Chinese name bitsCN.com
Mysql is sorted by Chinese name
SQL code
/*
Navicat MySQL Data Transfer
Source Server: local
Source Server Version: 50022
Source Host: localhost: 3306
Source Database: test
Target Server Type: MYSQL
Target Server versions: 50022
File Encoding: 65001
Date: 2012-11-19 15:46:13
*/
SET FOREIGN_KEY_CHECKS = 0;
------------------------------
-- Table structure for 'person'
------------------------------
Drop table if exists 'person ';
Create table 'person '(
'Id' int (10) unsigned not null auto_increment,
'Name' varchar (20) default NULL,
Primary key ('id ')
) ENGINE = InnoDB default charset = utf8;
------------------------------
-- Records of person
------------------------------
Insert into 'person 'values ('1', 'Zhang San ');
Insert into 'person 'values ('2', 'Lily ');
Insert into 'person 'values ('3', 'Wang 5 ');
Insert into 'person 'values ('4', 'ma 6 ');
Insert into 'person 'values ('5', 'Money 7 ');
Forward order:
Select * from person order by convert (name USING gbk );
Result:
2 Li Si
4 Ma 6
5 RMB 7
3. Wang Wu
1 Zhang San
Reverse order:
Select * from person order by convert (name USING gbk) desc
Result:
1 Zhang San
3. Wang Wu
5 RMB 7
4 Ma 6
2 Li Si
BitsCN.com