โ† SQL & Databases
#9 most askedVery commonEasyJoins

INNER vs LEFT vs RIGHT vs FULL JOIN

New to Joins? Learn it from scratch first
Combining Tables with JOIN โ†’
๐Ÿข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.
I was asked this

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.

    Try it ยท run and change it
    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 โ†’