exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 106 discussion

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

DRAG DROP -
You use Microsoft SQL Server to develop a database that has two tables named Div1Cust and Div2Cust.
Each table has columns named DivisionID and CustomerID.
You need to write a query that meets the following requirements:
✑ The rows in Div1Cust must be combined with the rows in Div2Cust.
✑ The result set must have columns named Division and Customer.
✑ Duplicates must be not retained.
Which three Transact-SQL statements should you use? (To answer, move the appropriate statements from the list of statements to the answer area and arrange them in the correct order.)
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.
The difference between Union and Union all is that Union all will not eliminate duplicate rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into a table.
We should also use the DISTINCT keyword in the third SELECT statement.
Incorrect: The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.
References:
https://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-optimal-performance-comparison/

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
Fadletime
4 years, 5 months ago
third box should be: select divisionID, customerID from Division2
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago