SQL ORDER BY ASC子句

此语句用于按升序排列数据进行排序。如果你错过了ASC属性,SQL ORDER BY查询默认情况下采用升序排列。
让我们的供应商的一个例子

SELECT supplier_city FROM suppliers WHERE supplier_name = 'IBM' ORDER BY supplier_city;

【SQL ORDER BY ASC子句】让我们以具有以下记录的客户表:
ID名称年龄地址薪水
1Himani gupta21Modinagar22000
2Shiva tiwari22博帕尔21000
3Ajeet bhargav45Meerut65000
4Ritesh yadav36Azamgarh26000
Balwant singh45瓦拉纳西36000
6马赫什·夏尔马26Mathura22000
这是对结果由NAME和SALARY升序排序的例子。
SELECT * FROM CUSTOMERS ORDER BY NAME,SALARY;

这将产生以下结果。
ID名称年龄地址薪水
3Ajeet bhargav45Meerut65000
Balwant singh45瓦拉纳西36000
1Himani古普塔21Modinagar22000
6Mahesh sharma26Mathura22000
4Ritesh yadav36阿扎姆加尔26000
2湿婆蒂瓦里22Bhopal21000

    推荐阅读