
Ultimate access to all questions.
Which SQL statement creates a table named all_transactions that contains all records from march_transactions and april_transactions without duplicate records?
A
CREATE TABLE all_transactions AS SELECT * FROM march_transactions INNER JOIN SELECT * FROM april transactions;
B
CREATE TABLE all_transactions AS SELECT * FROM march_transactions UNION SELECT * FROM april transactions;
C
CREATE TABLE al_transactions AS SELECT * FROM marchtransactions OUTER JOIN SELECT * FROM april_transactions;
D
CREATE TABLE all_transactions AS SELECT. * FROM march transactions INTERSECT SELECT * from apriltransactions;
E
CREATE TABLE all_transactions AS SELECT * FROM march_transactions MERGE SELECT * FROM april_transactions;
Explanation:
The correct answer is B because:
Let's analyze why the other options are incorrect:
A (INNER JOIN): This performs a join operation, not a union. It requires a join condition and returns only matching rows from both tables, not all records.
C (OUTER JOIN): This also performs a join operation (likely meant to be FULL OUTER JOIN) and requires a join condition. It returns matching rows plus non-matching rows from both tables, but still requires a join condition and doesn't combine all records in the way UNION does.
D (INTERSECT): This returns only the rows that appear in both tables (common rows), not all records from both tables.
E (MERGE): MERGE is used for upsert operations (update/insert) based on matching conditions, not for combining all records from two tables.
Note: The SQL syntax in option B has a minor issue - it should be UNION SELECT * FROM april_transactions (with proper table name spacing), but conceptually it's the correct approach. In proper SQL, it would be:
CREATE TABLE all_transactions AS
SELECT * FROM march_transactions
UNION
SELECT * FROM april_transactions;
CREATE TABLE all_transactions AS
SELECT * FROM march_transactions
UNION
SELECT * FROM april_transactions;
Key SQL Operators: