MYSQL 比较集

时间:2023-03-08 17:49:25
MYSQL 比较集

1、什么是较对集合:字符集的字符比较规则(collation,collate),一个字符集有多个较对集合。


mysql> create table ss (id int primary key auto_increment,
    -> cc char(10));
insert into ss values (null,"a");
insert into ss values (null,"A");
insert into ss values (null,"b");
insert into ss values (null,"B");
-------------------------------------------------------------
mysql> select * from ss order by cc asc;
+----+------+
| id | cc   |
+----+------+
|  1 | a    |
|  2 | A    |
|  3 | b    |
|  4 | B    |
+----+------+
 mysql> select * from ss order by cc desc;
+----+------+
| id | cc   |
+----+------+
|  3 | b    |
|  4 | B    |
|  1 | a    |
|  2 | A    |