exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 65 discussion

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

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section. You will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a database that includes the tables shown in the exhibit (Click the Exhibit button.)

You need to create a Transact-SQL query that returns the following information:
✑ the customer number
✑ the customer contact name
✑ the date the order was placed, with a name of DateofOrder
✑ a column named Salesperson, formatted with the employee first name, a space, and the employee last name
✑ orders for customers where the employee identifier equals 4
The output must be sorted by order date, with the newest orders first.
The solution must return only the most recent order for each customer.
Solution: You run the following Transact-SQL statement:

Does the solution meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
The MAX(orderdate) in the SELECT statement makes sure we return only the most recent order.
AWHERE o.empiD =4 clause is correctly used.
GROUP BY is also required.

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
masonsam
4 years, 5 months ago
Can't create a group by including the having statement. "o.empid"
upvoted 1 times
...
geekeek1
4 years, 5 months ago
it is A! it works guys
upvoted 1 times
...
Vermonster
4 years, 6 months ago
This works. You have to use firstname, lastname in GROUP BY clause because it is processed before the SELECT statement so the full name hasn't been produced yet so you can't group by it. We've already down-selected based on empid so duplicate names isn't an issue. Not optimally written but correct
upvoted 1 times
...
Andy7622
4 years, 6 months ago
Looks like A . But I have doubts about if the form of first name, last name that is used in GROUP BY clause is correct.
upvoted 1 times
...
Luzix
4 years, 7 months ago
✑ the date the order was placed, with a name of DateofOrder it´s ✑ orders for customers where the employee identifier equals 4 ¿So it´s should return all the orders id linked with the employee? I think this query don´t return this.
upvoted 1 times
NhiN
4 years, 7 months ago
"The solution must return only the most recent order for each customer."
upvoted 1 times
...
...
Jangstar
4 years, 9 months ago
Likely A. Some of the questions are obviously wrong on a technicality but stick with the elements from the question - they aren't trying to "trick" you.
upvoted 1 times
Jangstar
4 years, 9 months ago
Then again, maybe they are - missed the part where they implicitly want ALL orders, not the most recent.
upvoted 1 times
...
...
Kiruu23
4 years, 10 months ago
I Think the answer is B. there is no requirement to return Maximum date, all we have to return is most recent order data for emp_id =4 so, only order by clause can give the correct data.
upvoted 2 times
NhiN
4 years, 7 months ago
The solution must return only the most recent order for each customer. So we have to use MAX(OrderDate)
upvoted 3 times
...
Andy7622
4 years, 6 months ago
There is the requirement -Latest order.
upvoted 2 times
...
...
stm22
4 years, 11 months ago
good point , but these questions don't always go to that depth
upvoted 2 times
...
MML
5 years, 1 month ago
I think B is the right answer because salepernon fullname should be produced by concat function as we don't know anything about nullability in the columns so it would be more safe..
upvoted 2 times
Mosufe
4 years, 10 months ago
the columns might be not null, but i still think that is B because dont have a space between the names...
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 ...