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
To find customers who have NEVER placed an order, you LEFT JOIN Orders and then filter how?
Answer: WHERE Orders.id IS NULL
Unmatched rows have NULL in the order columns, so IS NULL isolates them.
When joining three tables A, B, and C, how many ON conditions are typically needed?
Answer: Two
Each additional joined table generally needs one more ON condition to link it.
Which comparison is INVALID for matching NULLs in a join condition?
Answer: column = NULL
NULL is never equal to anything, so '= NULL' never matches; use IS NULL.
A RIGHT JOIN of Employees and Departments keeps all rows from which table?
Answer: Departments
RIGHT JOIN preserves all rows from the right (second) table, Departments.
Why are table aliases especially useful in multi-table joins?
Answer: They shorten references and disambiguate same-named columns
Aliases make queries readable and resolve ambiguity when columns share names.
Placing a filter on the right table in the WHERE clause of a LEFT JOIN can have what effect?
Answer: It can turn the LEFT JOIN into an effective INNER JOIN
Filtering non-NULL right-table values in WHERE removes the NULL-padded unmatched rows.
Which join would you use to list every product alongside its sales, including products with zero sales?
Answer: LEFT JOIN with Products on the left
A LEFT JOIN keeps all products and NULL-fills those without sales.