exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 130 discussion

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

SIMULATION -
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 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.
✑ Order the results by the most recent OrderDate.
✑ Use the database name and table name for any table reference.
✑ Use the first initial of the table as an alias when referencing columns in atable.
The solution must support the ANSI SQL-99 standard and must NOT use object identifiers.
Part of the correct T-SQL statement has been provided in the answer area. Complete the SQL statement.

Show Suggested Answer Hide Answer
Suggested Answer: Please review the explanation part for this answer.
SELECT o.LastName,
MAX (o.OrderData) AS MostRecentOrderData

FROM Sales.Orders AS o -

GROUP BY o.CustomerID -
ORDER BY o.OrderDate DESC

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, 6 months ago
* add c.lastname after customerid to the GROUP BY clause
upvoted 2 times
Jaayu
4 years, 5 months ago
Correct
upvoted 1 times
...
...
Fadletime
4 years, 6 months ago
SELECT c.lastname, MAX(o.orderdate) as MostRecentOrder FROM Sales.Customers c JOIN Sales.Orders o on c.customerid = o.customerid GROUP BY c.customerid ORDER By MAX(o.orderdate) DESC
upvoted 1 times
...
lilupv
4 years, 9 months ago
I think we have to join results with Customer table. And LastName is from Customer.
upvoted 2 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 ...