exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 181 discussion

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

A company's sales team is divided in two different regions, North and South. You create tables named SalesNorth and SalesSouth. The SalesNorth table stores sales data from the North region. The SalesSouth table stores sales data from the South region. Both tables use the following structure:

You need to create a consolidated result set that includes all records from both tables.
Which Transact-SQL statement should you run?

  • A. SELECT SalesNorth.salesID, SalesNorth.customer, SalesNorth.amount, SalesSouth.SalesID, SalesSouth.customer, SalesSouth.amount FROM SalesNorth JOIN SalesSouth ON SalesNorth.salesID = SalesSouth.salesID
  • B. SELECT SalesNorth.salesID, SalesNorth.customer, SalesNorth.amount, SalesSouth.salesID, SalesSouth.customer, SalesSouth.amount FROM SalesNorth LEFT JOIN SalesSouth ON SalesNorth.salesID=SalesSouth.salesID
  • C. SELECT salesID, customer, amount FROM SalesNorth UNION ALL SELECT salesID, customer, amount FROM SalesSouth
  • D. SELECT salesID, customer, amount FROM SalesNorth UNION SELECT salesID, customer, amount FROM SalesSouth
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
References:
https://docs.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-2017

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
Vermonster
4 years, 5 months ago
No primary key and two different databases - I go with UNION ALL to make sure I don't miss anything and add key later
upvoted 1 times
...
BabyBee
4 years, 7 months ago
Isn't it valid in the same weight using UNION or UNION ALL? Or is it because of all the Nulls allow not to miss any possible client getting products from both North and South regions?
upvoted 1 times
sssshhhh
4 years, 5 months ago
"all records" requires a union all because like you said, clients can potentially have sales from both regions. When requiring ALL RECORDS from multiple tables it's 'never' safe enough to just do a union.
upvoted 1 times
...
...
stm22
4 years, 11 months ago
seems odd that no answer includes the region field
upvoted 2 times
sssshhhh
4 years, 5 months ago
it's asking for a consolidated result; no region column needed.
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 ...