Documentation

Join Types

SQL Joins are used to combine data from two different tables or data sources such as databases, flat files, web platforms or other systems. The type of join used to query your data is thereby crucial for the outcome of the result set. In both data sets you will need to have common fields in order to be able to join the tables. In datapine you can apply three different Join Types when using Drag & Drop.

 

Inner Join

 

The most common type of join is the Inner Join. The Inner Join matches all records that appear in both tables. Let’s assume you have two tables containing information about your customers and the orders your customers made. In one table you’ll store all information about your customers and in the other table you’ll find the order information.

 

2 example tables for an inner join

 

Joining these tables with an Inner Join on the CustomerID lets you easily combine the information stored in both tables.

 

resulting table after joining both tables with an inner join

 

Left Join

 

The Left Join will display all records from the left table and the corresponding values from the right. If there are no corresponding records for some entries in the right table they will be displayed as NULL.

 

2 example tables for a left join

 

Using the Customer and Order tables you will see that some customers did not make an order yet, so fields for OrderID and Amount will be empty in the result set.

 

resulting table after joining both tables via a left join

 

Right Join

 

The Right Join, similar to the Left Join, takes all records from the right table and displays all corresponding values from the left that match.

 

2 example tables for a right join

 

Looking at the example below, some of your customers might not have completely filled in their contact information such as their country of origin yet, resulting in a table like this:

 

resulting table after joining both tables with a right join

 

Looking at the three different result sets above, the join type influences the output of your queries in datapine. Therefore you might sometimes need to adjust the join type applied to your charts to get the desired results. Please click here to learn how to change the join type of your charts.