Menu

Post image 1
Post image 2
1 / 2
0

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

DEV Community·Michael·21 days ago
#oioP18MQ
#gbase#database#sql#join#outer#rows
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. There is no third fundamental logic. The Three Subclasses of Outer Join Outer join splits into three variants based on which table's rows are fully preserved : LEFT OUTER JOIN — preserves every row from the left table. RIGHT OUTER JOIN — preserves every row from the right table.…

Continue reading — create a free account

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

Read More