exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 44 discussion

Actual exam question from Microsoft's 70-461
Question #: 44
Topic #: 1
[All 70-461 Questions]

SIMULATION -
You have a database that contains the tables as shown in the exhibit. (Click the Exhibit button.)

You need to create a query that returns a list of products from Sales.ProductCatalog. The solution must meet the following requirements:
UnitPrice must be returned in descending order.

✑ The query must use two-part names to reference the table.
✑ The query must use the RANK function to calculate the results.
✑ The query must return the ranking of rows in a column named PriceRank.
✑ The list must display the columns in the order that they are defined in the table.
✑ PriceRank must appear last.
To answer, type the correct code in the answer area.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code.

Show Suggested Answer Hide Answer
Suggested Answer: Please review the explanation part for this answer.
Explantation:
SELECT ProductCatalog.CatID, ProductCatalog.CatName, ProductCatalog.ProductID,
ProductCatalog.ProdName,ProductCatalog.UnitPrice,
RANK() OVER (ORDER BY ProductCatalog.UnitPrice DESC) AS PriceRank

FROM Sales.ProductCatalog -
ORDER BY ProductCatalog.UnitPrice DESC
References:
https://msdn.microsoft.com/en-us/library/ms176102.aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Fadletime
4 years, 4 months ago
If you wanted to start the ranking with 1 first, you would order by pricerank asc. This would give the highest unitprice the ranking of 1.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago