categories.sql-transformation Basic
SQL JOIN Types Explained
Explain the differences between SQL JOIN types.
INNER JOIN
Returns only rows where the key matches in both tables. Non-matching rows are excluded.
LEFT JOIN (LEFT OUTER JOIN)
Returns all rows from the left table; fills NULL for unmatched right-table columns.
RIGHT JOIN
Returns all rows from the right table; fills NULL for unmatched left-table columns.
FULL OUTER JOIN
Returns all rows from both tables regardless of match; unmatched sides are NULL.
CROSS JOIN
Returns the Cartesian product — every combination of rows. Result rows = left count x right count.
SELF JOIN
Joins a table to itself, often used for hierarchical queries (e.g., employee-manager relationships).
When to Use
- Only matching data: INNER JOIN
- Keep all left-table rows: LEFT JOIN
- Analyze differences between both sides: FULL OUTER JOIN
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
