Data are often stored in different datasets based on the kind of data, so the data table is easy to view.
As a result, when you need to get data stored in other datasets, you need to join these datasets together.
Join can do this work.
There are four types of joins: left, right, inner, outer.
Let’s take a look at an example to grasp the concepts.
Assuming that you are going to a grocery store to buy apple, orange, and watermelon for your family; meanwhile, you mom is also going to a grocery store to buy apple, peach, and grapes.
The items that you bought is a dataset: apple, orange, watermelon. The dataset is called you. The column name for fruit items is also you.
The items that your mom bought is another dataset: apple, peach, grapes. The dataset is called your_mom. The column name for fruit items is also your_mom.
You want to know what you and your mom both have bought.
In this case, you can use outer join to find out.
Outer Join
SQL
SELECT * FROM you
OUTER JOIN your_mom
ON you.you = your_mom.your_mom