exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 172 discussion

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

SIMULATION -
You have a database named Sales that contains the tables sworn in the exhibit. (Click the Exhibit button.)

You need to create a query for a report. The query must meet the following requirements:
✑ Return the last name of the customer who placed the order.
✑ Return the most recent order date for each customer.
✑ Group the results by CustomerID.
✑ Display the most recent OrderDate first.
The solution must support the ANSI SQL-99 standard and must not use table or column aliases.
Part of the correct Transact-SQL has been provided in the answer area below. Enter the Transact-SQL in the answer area that resolves the problem and meets the stated goals or requirements. You can add Transact-SQL within the Transact-SQL segment that has been provided as well as below it.


Show Suggested Answer Hide Answer
Suggested Answer: Please review the explanation part for this answer.
1. SELECT LastName,
2 MAX(OrderDate) AS MostRecentOrderDate
3 FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
4 GROUP BY CustomerID
5 ORDER BY OrderDate DESC
On line 3 add Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID

On line 4 add CustomerID -

On line 5 add OrderDate DESC -
References:
https://technet.microsoft.com/en-us/library/ms190014(v=sql.105).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
lilupv
4 years, 9 months ago
1.SELECT LastName, 2 MAX(OrderDate) AS MostRecentOrderDate 3 FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID 4 GROUP BY Orders.CustomerID, LastName 5 ORDER BY MAX(OrderDate) DESC
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 ...