Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started