MySQL Sorted by Chinese name

Source: Internet
Author: User

MySQL Sort by Chinese name  sql code  www.2cto.com  /*  navicat MySQL Data Transfer    source Server        : local  source Server version:50022  source Host         &NBS P : localhost:3306  source Database      : Test    target Server Type    : MYS QL  target Server version:50022  file Encoding        : 65001    date:201 2-11-19 15:46:13  */   set foreign_key_checks=0;    ------------------------------ --Table structure for ' person '  ----------------------- ------- drop TABLE IF EXISTS ' person ';  create TABLE ' person ' (   ' id ' int (ten) unsigned not NULL auto_increment,    ' name ' varchar (20) Default NULL,    PRIMARY KEY   (' id ')  ) engine=innodb default Charset=utf8;    ------------------------------ --ReCords of person  ------------------------------ insert to ' person ' VALUES (' 1 ', ' Zhang San ');  insert into ' person ' VALUES (' 2 ', ' John Doe ');  insert into ' person ' VALUES (' 3 ', ' Harry ');  insert into ' person ' VALUES (' 4 ', ' Caifan ');  insert into ' person ' VALUES (' 5 ', ' money Seven ');    Positive Order:  select * from Person ORDER by CONVERT (name USING GBK); Results: 2John Doe4Caifan5Money Seven3Harry1Zhang SanReverse: SELECT * from Person ORDER by CONVERT (name USING GBK) desc Result: 1Zhang San3Harry5Money Seven4Caifan2John Doe

MySQL Sorted by Chinese name

Related Article

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.