How SQL JOINs work

Mike's Notes

Another gem from Neo Kim. I'm a visual learner and like the use of Venn Diagrams in the sketch.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library > Subscriptions > The System Design Newsletter
  • Home > Handbook > 

Last Updated

07/10/2025

How SQL JOINs work

By: Neo Kim
The System Design Newsletter: 01/10/2025

(explained in 2 mins or less):

  1. Inner join
    It returns rows with matching values in both tables
  2. Full outer join
    It returns all rows when there is a match in either the left or the right table
  3. Full outer exclusive
    It returns all rows from both tables with no match in the other table
  4. Left join
    It returns all rows from the left table and matched rows from the right table
  5. Left exclusive
    It returns rows from the left table with no match in the right table
  6. Right join
    It returns all rows from the right table and matched rows from the left table
  7. Right exclusive
    It returns rows from the right table with no match in the left table
  8. Cross join
    It returns the Cartesian product of both tables; every combination of rows
  9. Self join
    It joins a table with itself to compare rows within the same table

The JOIN clause lets you combine data from tables based on a related column.

What else?



No comments:

Post a Comment