What does a SQL join do?
A join combines rows from two tables according to a condition, letting a query retrieve related information stored separately.
Study 4 SQL Joins with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does a SQL join do?
A join combines rows from two tables according to a condition, letting a query retrieve related information stored separately.
What key relationship commonly connects joined tables?
A common join condition matches a foreign key in one table to the corresponding primary key in another.
What does the ON clause specify in a join?
The ON clause specifies the condition that determines which row pairs match.
What does JOIN mean when no join type is written?
JOIN by itself means INNER JOIN.
Which rows does an INNER JOIN return?
An INNER JOIN returns only row pairs that satisfy the join condition; unmatched rows from either table are omitted.
Which rows does a LEFT JOIN preserve?
A LEFT JOIN keeps every row from the left table and adds matching right-table data. Right-side columns are NULL when no match exists.
How can a LEFT JOIN find employees without a department match?
Filter for d.department_id IS NULL after a LEFT JOIN to return employees with no matching department.
Which rows does a RIGHT JOIN preserve?
A RIGHT JOIN preserves every row from the right table; unmatched rows have NULL in the left-table columns.
What does a FULL OUTER JOIN retain?
A FULL OUTER JOIN keeps all rows from both tables, combining matches and filling the other side's columns with NULL for unmatched rows.
How many rows can a CROSS JOIN produce from tables of sizes N and M?
A CROSS JOIN returns every possible row pair. With N and M rows, the result has N×M rows.
How do you join more than two tables?
Chain joins by adding a join and its condition for each relationship needed to retrieve the related data.
Why can a join repeat values from one table?
A one-to-many match produces multiple result rows for the one-side record—one for each matching many-side row.