Skip to main content
PreparationZone Logo
PreparationZone
Back to Fundamentals

Fundamentals · Medium · Free

Difference between LEFT, RIGHT, and FULL OUTER JOIN?

FresherFundamentalsDatabase Fundamentals
Model answer

OUTER JOINs

JoinKeeps
LEFTAll left rows + matches
RIGHTAll right rows + matches
FULLBoth sides, NULLs where no match
sql
SELECT c.name, o.id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id;
LEFT JOIN finds customers with zero orders (o.id IS NULL).