SQL Joins Visualized
A beginner friendly guide using graphics.
We can all agree Joins are some of the most inevitable statements in SQL regardless of where you find yourself in terms of processes surrounding data merging, data retrieval, data manipulation, ETL, and so on. There are two components, one is understanding the different types of joins, and the other, is distinguishing which to apply according to specific needs. I was once in those tragic shoes of numerous trials and errors before selecting the best fit (very inefficient practice).
The sole purpose of these visual images, is to thrust a long-lasting memory of the different types of joins without needing to flip through text books and articles.
Holy grail, right???
Let’s jump right into it!
FULL JOIN
Also known as Full Outer Join — Returns all records when there is a match in either the left table or right table. Simply say, full join return records from both tables no matter if there are NULL values.
SELECT *
FROM Table_x
FULL JOIN Table_y ON Table_x.ID = Table_y.ID