- 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:

推薦閱讀
- 工業(yè)機(jī)器人產(chǎn)品應(yīng)用實(shí)戰(zhàn)
- Java實(shí)用組件集
- 現(xiàn)代機(jī)械運(yùn)動(dòng)控制技術(shù)
- iClone 4.31 3D Animation Beginner's Guide
- 21天學(xué)通Visual Basic
- 新手學(xué)電腦快速入門
- Excel 2007終極技巧金典
- Spark大數(shù)據(jù)商業(yè)實(shí)戰(zhàn)三部曲:內(nèi)核解密|商業(yè)案例|性能調(diào)優(yōu)
- Natural Language Processing and Computational Linguistics
- EDA技術(shù)及其創(chuàng)新實(shí)踐(Verilog HDL版)
- 互聯(lián)網(wǎng)單元測試及實(shí)踐
- 白話機(jī)器學(xué)習(xí)算法
- SQL Server 2017 Machine Learning Services with R
- ESP8266 Internet of Things Cookbook
- C# Machine Learning Projects