如何根据多列获取已排序的输出?
我们可以在 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)
广告