SQL Joins and Unions Explained

The Test Lead
5 min readDec 28, 2022

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…

--

--

The Test Lead
The Test Lead

Written by The Test Lead

Lead SDET at fintech company in NYC. Visit personal page http://thetestinglead.com// Twitter @juss_bailey Youtube @The Test Lead

No responses yet