Mysql is sorted by Chinese name _ MySQL

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.