Joins in SQL

Home

Blogs

Joins in SQL

Written by

Carissa O'Connell

August 10, 2022; Updated: Jan 2024

JOIN is an SQL clause used to query and access data from multiple tables, based on logical relationships between those tables.

Inner Join

The SQL INNER JOIN returns the records where table1 and table2 intersect.

inner join

Left (Outer) Join

This join returns all the rows of the table on the left side of the join and matches rows for the table on the right side of the join. For the rows for which there is no matching row on the right side, the result-set will contain null.

left join

Right (Outer) Join

RIGHT JOIN is similar to LEFT JOIN. This join returns all the rows of the table on the right side of the join and matching rows for the table on the left side of the join. For the rows for which there is no matching row on the left side, the result-set will contain null.

right join

Full (Outer) Join

A FULL JOIN combines the results of both LEFT JOIN and RIGHT JOIN. The result-set will contain all the rows from both tables. For the rows for which there is no match, the result-set will contain NULL values.

outer join

Image placeholder
Carissa O'Connell

Aloha! I am a passionate software developer looking to help people create programs that help improve business efficiency, connect with nature, and play with logic.