Skip to main contentSkip to solution

Consider the following 'CONSOLES' and 'COST' table:

CONSOLES

ProIDNameColor
1XBOXBlack
2PS5White
3SteamMachineBlack

COST

ProIDSpacePrice
1512GB499
11TB599
2512GB499
21TB599

Which of the query will result in the following output?

ProIDNameColorSpacePrice
1XBOXBlack512GB499
1XBOXBlack1TB599
2PS5White512GB499
2PS5White1TB599

Solution

✅ Correct Option: 3

A NATURAL JOIN joins the two tables on all columns with the same name, here ProID, and shows that column only once. It keeps only matching rows, so SteamMachine (ProID 3), which has no entry in COST, is dropped. The result has the columns ProID, Name, Color, Space, Price, with 4 rows, exactly as shown.


Options 1 and 4: an outer join (LEFT or full) keeps unmatched rows from CONSOLE, so SteamMachine would appear with NULL Space and Price. With SELECT * it would also show ProID twice, since the join uses ON rather than natural matching.

Option 2: UNION combines the rows of two queries and does not accept an ON condition, so it is not a join.

2026: 11 May Shift 2

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question