CORRECT TEXT

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


You need to create a query for a report. The query must meet the following requirements:
NOT use object delimiters.
Use the first initial of the table as an alias.
Return the most recent order date for each customer.
Retrieve the last name of the person who placed the order.
The solution must support the ANSI SQL-99 standard.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code.


microsoft-exams

One thought on “CORRECT TEXT

  1. LastName may not be unique. We can’t group by LastName only.
    The correct answer is here:
    SELECT C.LastName, MAX(O.OrderDate) As MostRecentOrderDate
    FROM Customers AS C inner join Orders as O
    ON C.CustomerID = O.CustomerID
    GROUP BY c.CustomerID, C.LastName
    ORDER BY MostRecentOrderDate DESC

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.