#9 most askedVery commonEasyJoins
INNER vs LEFT vs RIGHT vs FULL JOIN
New to Joins? Learn it from scratch firstCombining Tables with JOIN โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Explain the different JOIN types. Then run the demo to see how many rows each one returns for customers and orders.
๐ค Answer it out loud, then check yourself
Say your answer as if the interviewer is listening (30โ90 seconds). Then reveal what a strong answer covers and tick what you said.
SELECT 'inner' AS join_type, COUNT(*) AS rows_returned FROM customers c JOIN orders o ON o.customer_id = c.id UNION ALL SELECT 'left', COUNT(*) FROM customers c LEFT JOIN orders o ON o.customer_id = c.id UNION ALL SELECT 'full', COUNT(*) FROM customers c FULL OUTER JOIN orders o ON o.customer_id = c.id UNION ALL SELECT 'cross', COUNT(*) FROM customers CROSS JOIN orders;
Answer out loud first, then compare.
Want to rehearse it?Answer this to the AI interviewer and get a verdict โ