个性化阅读
专注于IT技术分析

SQL ORDER BY DESC子句

此语句用于按降序排序数据。你应该在你的订单按如下方式使用DESC属性BY子句。

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

让我们来看看雇员表的例子:

ID名称年龄地址薪水
1Himani gupta21Modinagar22000
2Shiva tiwari22博帕尔21000
3Ajeet bhargav45Meerut65000
4Ritesh yadav36Azamgarh26000
Balwant singh45瓦拉纳西36000
6马赫什·夏尔马26Mathura22000

这是对结果由NAME降序排序的例子。

SELECT * FROM CUSTOMERS
ORDER BY NAME DESC;

这将产生以下结果。

ID名称年龄地址薪水
2Shiva tiwari22Bhopal21000
4Ritesh yadav36阿扎姆加尔26000
6马赫什·夏尔马26Mathura22000
1Himani gupta21Modinagar22000
Balwant singh45瓦拉纳西36000
3Ajeet bhargav45Meerut65000
赞(0)
未经允许不得转载:srcmini » SQL ORDER BY DESC子句

相关推荐

评论 抢沙发

评论前必须登录!