Loading, please wait...

Joins

Introduction To Type Of Joins In SQL

 

Introduction:
In this article, you will learn how many types of joins are there in SQL.

We know that joins are used to collect the data between the two or more tables. Thus, we use SQL joins in different ways, according to our condition.

 

Some types of SQL Joins are as follows:

 

 

 

INNER JOIN: Inner Join represents the common data between the two or more tables. This join generates the output in a new table. In this query, we check each row of one table to another row of the second table and then collect all the common data from each table. An inner join is used to create the very large set of the dataset from both the tables.

 

 

LEFT JOIN: Left Join combines the two or more tables in a single table and shows all the data from the left table. It does not matter that our data matches or not, based on the condition. It also gives an output in a new table.

 

 

 

RIGHT JOIN: Right Join also combines the two or more tables in a single table and shows all the data from the right table. It shows the data, even if our data is matched or not, based on the condition. It also gives an output in a new table. In this query, we check the data of each table, but it shows only right table data.

 

 

 

FULL JOIN: Full Join represents all the data from each table. It shows the data, even if our data is matched or not, based on the requirement. It contains all the data of the first table and the second table. In this query, it is not possible that any data is left, based on the condition.

 

 

 

SELF JOIN: Self join adds a new table itself. It temporarily renames at least one table in SQL statement.

 

CARTESIAN JOIN: It returns the Cartesian product of the records, which means from the two or more joined tables. This SQL query, multiplies the first table records into the second table records.


Summary:
Thus, we learned about the types of joins in SQL.