Which Transact-SQL statement should you run?

Posted by: Pdfprep Category: 70-761 Tags: , ,

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, amountFROM SalesNorth UNION ALL SELECT salesID, customer, amountFROM SalesSouth
D . SELECT salesID, customer, amountFROM SalesNorth UNION SELECT salesID, customer, amountFROM SalesSouth

Answer: C

Explanation:

References: https://docs.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-2017

Leave a Reply

Your email address will not be published.