- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 113字
- 2021-06-24 14:38:10
ORDER BY
The ORDER BY clause orders the results. The default order is ascending, meaning that the ASC keyword can be omitted. To produce the result set in descending order, DESC must be set explicitly. Building on the same example from the WHERE section, the following code block is used to explicitly present results in descending order of product name and location name:
SELECT P.Name AS ProductName, [PI].Quantity, L.Name AS LocationName
FROM Production.Product AS P
INNER JOIN Production.ProductInventory AS [PI] ON P.ProductID = [PI].ProductID
INNER JOIN Production.Location AS L ON [PI].LocationID = L.LocationID
WHERE P.Name LIKE 'Touring%'
ORDER BY P.Name DESC, L.Name DESC;
The following screenshot shows the results in the specified order:

推薦閱讀
- AutoCAD繪圖實(shí)用速查通典
- Hands-On Internet of Things with MQTT
- Google Cloud Platform Cookbook
- 手把手教你學(xué)AutoCAD 2010
- 自動(dòng)檢測(cè)與轉(zhuǎn)換技術(shù)
- 網(wǎng)絡(luò)化分布式系統(tǒng)預(yù)測(cè)控制
- Hadoop應(yīng)用開發(fā)基礎(chǔ)
- Apache源代碼全景分析(第1卷):體系結(jié)構(gòu)與核心模塊
- 簡明學(xué)中文版Photoshop
- 手把手教你學(xué)Photoshop CS3
- 樂高創(chuàng)意機(jī)器人教程(中級(jí) 上冊(cè) 10~16歲) (青少年iCAN+創(chuàng)新創(chuàng)意實(shí)踐指導(dǎo)叢書)
- 中老年人學(xué)電腦與上網(wǎng)
- Windows 7來了
- 網(wǎng)絡(luò)信息安全項(xiàng)目教程
- MySQL Management and Administration with Navicat