我们可以在 ORDER BY 子句中指定多列,以根据这些多列获得排序的输出。以下为使这个概念更清晰的例子 -
mysql> Select * from Student ORDER BY Name, Address;
+------+---------+---------+-----------+
| Id | Name | Address | Subject |
+------+---------+---------+-----------+
| 2 | Aarav | Mumbai | History |
| 1 | Gaurav | Delhi | Computers |
| 15 | Harshit | Delhi | Commerce |
| 17 | Raman | Shimla | Computers |
+------+---------+---------+-----------+
4 rows in set (0.12 sec)