Question: Enter and execute the following query to return information on four specific customers. Notice that the partition_by_clause is omitted, so the ranking function applies to

Enter and execute the following query to return information on four specific customers. Notice that the partition_by_clause is omitted, so the ranking function applies to the entire result set.

SELECT CustomerID, SalesOrderID, SubTotal, RANK () OVER (ORDER BY SubTotal DESC) AS




SELECT CustomerID, SalesOrderID, SubTotal, RANK () OVER (ORDER BY SubTotal DESC) AS Rank FROM Sales.SalesOrderHeader WHERE CustomerID IN (599, 514, 638, 72) ORDER BY SubTotal Desc Your result set should look similar to Figure 4-21. Figure 4-21 Results Messages A partial RANK CustomerID SalesOrderID SubTotal Rank 1 599 51131 224356.4831 1 result set 2 638 46981 182344.2664 2 3 514 46616 182344.2664 2 4 72 47395 179754.1225 4 5 599 67305 140506.874 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!