
Explanation:
The UNION SQL command is designed to combine the results of two or more SELECT statements without including duplicate rows. Since march_transactions and april_transactions do not have duplicate records, using UNION to merge these datasets into all_transactions ensures all unique records from both months are included. INNER JOIN and OUTER JOIN require a matching condition and are not suitable here. INTERSECT finds common records, which there are none by premise, and MERGE is not a valid SQL operation for combining records in this manner.
Ultimate access to all questions.
No comments yet.
A data engineering team has two tables: march_transactions, containing all retail transactions for March, and april_transactions, containing all transactions for April. There are no duplicate records between these tables. To create a new table, all_transactions, that combines records from both march_transactions and april_transactions without duplicates, which SQL command should be used?
A
CREATE TABLE all_transactions AS SELECT * FROM march_transactions UNION SELECT * FROM april_transactions;
B
CREATE TABLE all_transactions AS SELECT * FROM march_transactions OUTER JOIN SELECT * FROM april_transactions;
C
CREATE TABLE all_transactions AS SELECT * FROM march_transactions INNER JOIN SELECT * FROM april_transactions;
D
CREATE TABLE all_transactions AS SELECT * FROM march_transactions MERGE SELECT * FROM april_transactions;
E
CREATE TABLE all_transactions AS SELECT * FROM march_transactions INTERSECT SELECT * from april_transactions;