exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 152 discussion

Actual exam question from Microsoft's 70-761
Question #: 152
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 named DB1 that contains two tables named Sales.Customers and Sales.Orders. Sales.Customers has a foreign key relationship to a column named CustomerID in Sales.Orders.
You need to recommend a query that returns all the customers. The query must also return the number of orders that each customer placed in 2016.
Solution: You recommend the following query:

Does this meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
Dieter
Highly Voted 5 years, 10 months ago
Is this correct? It does not fullfill the requirement "The query must also return the number of orders that each customer placed in 2016." => where is the filter to 2016?
upvoted 18 times
...
Dieter
Highly Voted 5 years, 10 months ago
Additionally, the ON clause is not correct comparing customerid and orderid
upvoted 7 times
fe
5 years, 6 months ago
Additionally, for customers with no orders, there will be a count of 1 because of the left join
upvoted 4 times
...
...
Billybob0604
Most Recent 4 years, 5 months ago
So you need the number of orders and you're counting the customerid's.....very strange and wrong
upvoted 1 times
...
mamarach
5 years ago
Missing the HAVING Clause, I think
upvoted 1 times
...
Anette
5 years ago
Wrong. Many reasons as everyone mentioned
upvoted 2 times
...
cyan
5 years, 3 months ago
The answer is No. The right query is: SELECT Cust.CustName, NumberOfOrder = COUNT(ORD.CUSTOMERID) FROM Sales.Customers Cust LEFT JOIN (SELECT * FROM Sales.Orders WHERE YEAR(orderdate)=2016) Ord ON Cust.CustomerID=Ord.CustomerID GROUP BY Cust.CustomerName;
upvoted 6 times
Billybob0604
4 years, 5 months ago
still wrong. you count customerids whereas number of orders is needed
upvoted 1 times
...
...
Andybug
5 years, 4 months ago
this is wrong it must comply with the year
upvoted 2 times
...
mlourinho
5 years, 7 months ago
We can read in the question "Sales.Customers has a foreign key relationship to a column named CustomerID in Sales.Orders.". So it cannot be "ON Cust.CustomerID = Ord.OrderID"
upvoted 3 times
...
dragan
5 years, 9 months ago
Answer is No
upvoted 5 times
...
AshleyLiang
5 years, 10 months ago
Agree. However, it seems the topic concerned here is the difference between COUNT(*) and COUNT(CustomerID).
upvoted 4 times
...
safiullah
5 years, 10 months ago
Also what I see wrong is that the "join" predicate is comparing with the wrong column i.e. "order id" and not "customer_id"
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 ...