
Ultimate access to all questions.
Answer-first summary for fast verification
Answer: INNER JOIN
## Explanation An **INNER JOIN** is the correct SQL command for this scenario because: - **INNER JOIN** returns only the rows that have matching values in both tables based on the specified key column - It horizontally combines tables (side-by-side) using a shared column as the join key - It filters out rows where the key column value exists in only one table - Only rows with matching key values in both tables are included in the result **Why other options are incorrect:** - **OUTER JOIN** (B): Returns all rows from both tables, including non-matching rows (fills with NULLs) - **LEFT JOIN** (C): Returns all rows from the left table and matching rows from the right table - **MERGE** (D): Used for upsert operations (update/insert), not for horizontal table combination in queries - **UNION** (E): Vertically combines tables (stacking rows), not horizontally combining columns The key requirements in the question are: - Horizontal combination of tables - Using a shared column as key - Only rows with matching key values in both tables - INNER JOIN perfectly satisfies all these requirements.
Author: LeetQuiz .
Question 19
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
No comments yet.