Explain the difference between an INNER JOIN and an OUTER JOIN (LEFT/RIGHT/FULL).

Last updated 3 July 2026

An INNER JOIN returns only rows that match in both tables, while an OUTER JOIN preserves unmatched rows from one or both sides and fills the missing columns with NULL.

  • INNER JOIN: Intersection: rows present in both tables based on the join condition.

  • LEFT OUTER JOIN: All rows from the left table plus matches; unmatched right side is NULL.

  • RIGHT OUTER JOIN: Mirror of LEFT: all rows from the right table, unmatched left side is NULL.

  • FULL OUTER JOIN: Union of both: all rows from both tables, with NULL where either side is missing.

  • Practical tip: Use a LEFT JOIN with a WHERE right.key IS NULL filter to find rows in one table that have no counterpart in the other.

  • https://dev.to/michaelfv/inner-vs-outer-joins-the-two-fundamental-join-types-in-sql-2jf5
  • https://medium.com/@justarnav/joins-demystified-how-i-finally-understood-inner-vs-outer-joins-3e97b7cc9e5c
  • https://www.freecodecamp.org/news/sql-join-types-inner-join-vs-outer-join-example/
  • https://learn.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-ver17
  • https://www.postgresql.org/docs/current/tutorial-join.html
  • https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
All SQL interview questions