ZZomato·BehavioralL3DSA Round

Difference Between Inner Join and Outer Join in SQL

viaGlassdoor

Question: What is the difference between an INNER JOIN and an OUTER JOIN in SQL, and which is typically faster?

Answer framing: An INNER JOIN returns only rows with matching keys in both tables. An OUTER JOIN (LEFT/RIGHT/FULL) returns matched rows plus unmatched rows from one or both sides, filling in NULLs for the missing side. INNER JOIN is generally cheaper because it only needs to produce the intersection of matching rows and can leverage indexes more efficiently, while OUTER JOINs must additionally track and emit unmatched rows from the preserved side(s) - though actual cost depends heavily on indexing, table sizes, and the query optimizer.

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account