Programming · Flashcard

10 customers, 4 with orders. How many rows does a LEFT JOIN give?

  • ATen, with NULL order columns for the six that have none
  • BFour, since only the customers with orders can match
  • CSix, returning just the customers who never ordered
  • DFourteen, the matches plus every unmatched row of both

Why this is the answer

A LEFT JOIN keeps all ten left-hand rows and fills the right-hand columns with NULL where nothing matched. Four is the inner join, six is what you get by adding WHERE orders.id IS NULL, and fourteen would need a FULL OUTER JOIN with unmatched rows on both sides.

Official docs
Study in Gnoseed →