Mysql is sorted by Chinese name

Source: Internet
Author: User


Mysql sorts the SQL code www.2cto.com/* Navicat MySQL Data Transfer Source Server: local Source Server Version: 50022 Source Host: localhost: 3306 Source Database: test Target Server Type: MYSQL Target Server Version: 50022 File Encoding: 65001 Date: 2012-11-19 15:46:13 */SET FOREIGN_KEY_CHECKS = 0; -- -------------------------- -- Table structure for 'body' -- dropping drop table if exists 'body '; create table 'People' ('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', 'Qian 7'); Forward order: select * from person order by convert (name USING gbk); Result: 2 LI 4 4 Ma 6 5 yuan 7 3 Wang 5 1 Zhang 3 inverted ORDER: select * from person order by convert (name USING gbk) result of desc: 1 Zhang San 3 Wang Wu 5 Qian Qi 4 Ma 6 2 LI 4

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.