让我们首先创建一个表-
mysql> create table DemoTable -> ( -> Id int, -> Value int -> );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable values(100,85885); mysql> insert into DemoTable values(101,885995474); mysql> insert into DemoTable values(100,895943);
使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
输出结果
+------+-----------+ | Id | Value | +------+-----------+ | 100 | 85885 | | 101 | 885995474 | | 100 | 895943 | +------+-----------+ 3 rows in set (0.00 sec)
以下是对多列进行排序的查询-
mysql> select Id,Value from DemoTable order by Value DESC;
输出结果
+------+-----------+ | Id | Value | +------+-----------+ | 101 | 885995474 | | 100 | 895943 | | 100 | 85885 | +------+-----------+ 3 rows in set (0.00 sec)