
Ultimate access to all questions.
A data engineer wants to horizontally combine two tables as a part of a query. They want to use a shared column as a key column, and they only want the query result to contain rows whose value in the key column is present in both tables.
Which of the following SQL commands can they use to accomplish this task?
A
INNER JOIN
B
OUTER JOIN
C
LEFT JOIN
D
MERGE
E
UNION
Explanation:
An INNER JOIN is the correct SQL command for this scenario because:
SELECT *
FROM table1
INNER JOIN table2
ON table1.key_column = table2.key_column;
SELECT *
FROM table1
INNER JOIN table2
ON table1.key_column = table2.key_column;
This query will return only rows where the key_column value exists in both table1 and table2.