โ† All SQL Flashcard Decks

Joining Multiple Tables Flashcards

7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Joining Multiple Tables flashcards as text
  1. What does a NATURAL JOIN do automatically?

    Answer: Joins on all columns with the same name in both tables

    NATURAL JOIN matches every pair of identically named columns without an ON clause.

  2. In a query joining Orders o and Customers c, which expression correctly references the customer name?

    Answer: c.name

    You qualify a column with its table alias using alias.column syntax.

  3. An INNER JOIN between two tables with a one-to-many relationship can return what?

    Answer: More rows than the 'one' table has

    Each parent row repeats once per matching child row, multiplying output rows.

  4. Which is the correct order of clauses in a join query?

    Answer: FROM ... JOIN ... ON ... WHERE ... GROUP BY

    JOIN and ON come within FROM, before WHERE and GROUP BY.

  5. To count orders per customer including customers with no orders, you combine a LEFT JOIN with which aggregate trick?

    Answer: COUNT(Orders.id) instead of COUNT(*)

    COUNT of the right-table key ignores NULLs, yielding 0 for customers with no orders.

  6. Which join type is most likely to produce an unexpectedly huge result if the ON condition is omitted?

    Answer: CROSS JOIN (or a JOIN written without ON)

    Without a join condition, every row pairs with every row, exploding the row count.

  7. When two joined tables both have a column called 'status', how do you select it unambiguously?

    Answer: Prefix it with the table name or alias

    Ambiguous column names must be qualified by their table or alias.