SQL Joins and Unions Explained
In SQL we use commands to combine information located in different tables. This helps us analyze more data and use large datasets.
This article will go over
- SQL Join(Inner join)
- SQL Left Join
- SQL Right Join
- SQL Full Outer Join
- SQL Union
SQL Join(Inner join)
The join command allows you to combine rows of data from 2 or more tables. The most common join, inner join, will return the values that match in all of the tables in your statement.
The command looks like either option below using an inner join or just join
Select * from Table1 INNER JOIN
Table2 on Table1.name_of_column = Table2.name_of_column
Select * from Table1 INNER JOIN
Table2 on Table1.name_of_column = Table2.name_of_column
Select * from Table1 JOIN
Table2 on Table1.name_of_column = Table2.name_of_column
Select * from Table1 JOIN
Table2 on Table1.name_of_column = Table2.name_of_column
You can select specific columns to display in your result set by adding the column names to your select statement. The columns that you are joining the…