Menu

1 / 2

Inner vs Outer Joins: The Two Fundamental Join Types in SQL

DEV Community·Michael·6 months ago
#oioP18MQ
#gbase#database#sql#join#outer
Reading 0:00
15s threshold

SQL joins fall into two fundamental categories — inner joins and outer joins — while LEFT , RIGHT , and FULL joins are subclasses of the outer join. This hierarchy is defined by the logical principle of "which rows are included in the result set" and "which table's unmatched rows are preserved".

The Two Fundamental Types

Type Core Logic Result Set

INNER JOIN "Match only — discard what doesn't match" Returns only rows that satisfy the join condition in both tables.

OUTER JOIN "Keep one side as the base — pad NULLs where no match exists" Returns all rows from one (or both) tables, filling in NULLs on the opposite side where necessary.

An inner join returns the set intersection; an outer join keeps unmatched rows alive.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.