JuniorJunior (1–3 yrs)CodingSQLAmazonFlipkart
INNER JOIN vs LEFT JOIN
When do you use INNER JOIN vs LEFT JOIN?
Answers use simple, clear English.
Quick interview answer
INNER JOIN returns only matching rows in both tables. LEFT JOIN returns all rows from the left table and matches from the right (NULLs if missing). Use LEFT when you must keep parent rows even without children (e.g., customers without orders).
Detailed answer
INNER JOIN returns only matching rows in both tables. LEFT JOIN returns all rows from the left table and matches from the right (NULLs if missing). Use LEFT when you must keep parent rows even without children (e.g., customers without orders).
Code example
SELECT c.name, o.id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id;Practice code · sql (view only · no execution)
SELECT c.name, o.id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id;#sql#joins