DA0-002 · Question #58
A data analyst needs to create a combined report that includes information from the following two tables: Which of the following query methods should the analyst use for this task?
The correct answer is C. Union. To combine information from two tables with identical column structures into a single report, the data analyst should use the UNION query method.
Question
A data analyst needs to create a combined report that includes information from the following two tables:
Which of the following query methods should the analyst use for this task?
Options
- AGroup
- BJoin
- CUnion
- DNested
How the community answered
(44 responses)- A2% (1)
- B2% (1)
- C91% (40)
- D5% (2)
Why each option
To combine information from two tables with identical column structures into a single report, the data analyst should use the UNION query method.
GROUP BY is used to aggregate data based on one or more columns, not to combine rows from different tables.
JOIN is used to combine columns from two or more tables based on a related column between them, not to append rows of similarly structured tables.
The UNION query method is used to combine the result sets of two or more SELECT statements into a single result set. It requires that each SELECT statement within the UNION has the same number of columns, and that the columns have compatible data types, which aligns with the given scenario of two tables having identical column structures.
A nested query (or subquery) is a query embedded within another query, used to filter or retrieve specific data, not directly to combine entire result sets from separate tables.
Concept tested: SQL UNION operation
Source: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-union-transact-sql
Topics
Community Discussion
No community discussion yet for this question.