shlogg · Early preview
Clever Cottonmouth @mirajhad

Joining Tables: Inner, Outer, Left, Right & Full Explained

Inner join: A intersect B (common rows). Outer join: A union B (all rows from both tables). Inner join gives intersection, outer join gives union.

Assuming you're joining on columns with no duplicates, which is a very common case:

  
  
  An inner join of A and B gives the result of A intersect B, i.e. the inner part of a Venn diagram intersection.

  
  
  An outer join of A and B gives the results of A union B, i.e. the outer parts of a Venn diagram union.

Examples
Suppose you have two tables, with a single column each, and data as follows:

Note that (1,2) are unique to A, (3,4) are common, and (5,6) are unique to B.

  
  
  Inner join

An inner join using either of the equivalent queries gives the intersection of the two tables, i...