PrepAway - Latest Free Exam Questions & Answers

You need to create a query that meets the following requirements: References columns by using one-part names o

CORRECT TEXT
You have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit
button.)

You need to create a query that meets the following requirements:
References columns by using one-part names only.
Groups aggregates by SalesTerritorylD, and then by ProductlD.
Orders the results in descending order by SalesTerritorylD and then by ProductlD.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation

Explanation:
SELECT SalesTerritoryID,
ProductID,
AVG(UnitPrice),
MAX(OrderQty)
MAX(DiscountAmount)
FROM Sales.Details
GROUP BY SalesTerritoryID, ProductID
ORDER BY SalesTerritoryID DESC, ProductID DESC

One Comment on “You need to create a query that meets the following requirements: References columns by using one-part names o


Leave a Reply