DA0-001 · Question #186
Which of the following statements would be used to append two tables that have the same number of columns?
The correct answer is A. UNION ALL. To combine the result sets of two tables that have the same number of columns into a single, appended result, the UNION ALL SQL statement is used.
Question
Which of the following statements would be used to append two tables that have the same number of columns?
Options
- AUNION ALL
- BMERGE
- CGROUP BY
- DJOIN
How the community answered
(19 responses)- A89% (17)
- B5% (1)
- C5% (1)
Why each option
To combine the result sets of two tables that have the same number of columns into a single, appended result, the `UNION ALL` SQL statement is used.
The `UNION ALL` operator concatenates the result sets of two or more `SELECT` statements, including all duplicate rows, provided that the number of columns and their data types are compatible across all involved queries.
The `MERGE` statement in SQL is used for conditionally inserting, updating, or deleting rows in a target table based on matching or non-matching rows from a source, not for simply appending two tables.
Concept tested: SQL - UNION ALL operator
Source: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/union-transact-sql
Topics
Community Discussion
No community discussion yet for this question.