SQL — Mastering SQL Joins with table examples (Step-by-Step)

Übermensch
3 min readOct 23, 2023

💻 Hi, I am a student from Data Science field. In this post, I would like to share what I’ve learned, while solving MySQL problems in LeetCode and HackerRank. I’ll cover the following topics in this post :

  • Outer Join : Left Outer / Right Outer / Full Outer
  • Anti Join : Left Anti / Right Anti / Full Anti
  • Inner Join

Let’s dive in!

During understanding the low level of each join function and different characteristics, I realized studying SQL Joins with tables and diagrams, rather than coding with SQL queries straight away.

Therefore, in this article, I only added a brief definition of each SQL JOIN but added tables and diagrams as well for step-by-step guide. Hopefully, this helps you to understand different features of each JOIN functions.

Assuming we have 2 tables of table A and B as below :

1. Left Outer Join

It joins 2 tables retrieving all rows from table A, even if they do not exist in table B. Empty values will be marked as NULL.

--

--