Joins · SQL SQL
What is the primary difference between an INNER JOIN and a LEFT OUTER JOIN in ANSI SQL?
Practice question from Joins (SQL SQL), with the correct answer and a step-by-step solution.
easy · MCQ · Q-B4E7E2
What is the primary difference between an INNER JOIN and a LEFT OUTER JOIN in ANSI SQL?
- A.INNER JOIN returns all rows from both tables, while LEFT OUTER JOIN returns only matching rows.
- B.INNER JOIN returns only matching rows from both tables, while LEFT OUTER JOIN includes all rows from the left table regardless of whether there is a match in the right table.Correct answer
- C.LEFT OUTER JOIN requires a WHERE clause, whereas INNER JOIN does not.
- D.There is no functional difference; they are aliases for the same operation.
Solution
An INNER JOIN filters the result set to include only the rows that satisfy the join condition in both tables. A LEFT OUTER JOIN ensures that all rows from the left-hand table are preserved, filling in NULL values for columns from the right-hand table if no match is found.
More from Joins
- Consider two tables: A with 5 rows and B with 4 rows. If you perform a CROSS JOIN between A and B without any WHERE clause, how many rows w…
- What will be the behavior of a FULL OUTER JOIN between Table X and Table Y if there are rows in Table Y that do not match any rows in Table…
- Explain the semantic difference between placing a condition in the ON clause versus the WHERE clause when performing a LEFT OUTER JOIN.
- Which of the following queries demonstrates a self-join?
Practise more SQL
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed