Multiple choice technology databases

Which type of join should be written to perform an outer join of tables A and B that returns all rows from B?

  1. Any outer join

  2. A left outer join

  3. A cross join

  4. A right outer join

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A right outer join returns all rows from the right table (B) and matching rows from the left table (A). The 'right' designation refers to the table on the right side of the JOIN keyword. Left outer join would return all rows from A instead.

AI explanation

A right outer join is correct. In 'A B' syntax, a RIGHT OUTER JOIN preserves every row from the right-hand table (B) in the result, filling in NULLs for A's columns where there's no matching row — exactly matching the requirement to return all rows from B. A left outer join would instead guarantee all rows from A, not B. A cross join produces the full Cartesian product with no filtering semantics tied to preserving one side. 'Any outer join' is too vague since only one specific join type satisfies the 'all rows from B' requirement.