Skip to content

7 SQL joins in one image (Inner, Left, Right and Full Join)

In SQL language, joins are not always easy to understand when you discover them for the first time. Even with a little experience, you sometimes need a memory aid so as not to confuse a LEFT JOIN and a RIGHT JOIN. To simplify your life, sql.sh offers you this infographic reminding you of the main joins.

Download, bookmark, print, share, do whatever you want to have this image on hand and no longer have an excuse not to know SQL joins.

SQL Joins

Image content (accessibility)

The image presents 7 SQL queries with a visual representation of the results obtained from 2 tables: A and B.

INNER JOIN

SELECT *
FROM A
INNER JOIN B ON A.key = B.key

LEFT JOIN

SELECT *
FROM A
LEFT JOIN B ON A.key = B.key

LEFT JOIN (without the intersection of B)

SELECT *
FROM A
LEFT JOIN B ON A.key = B.key
WHERE B.key IS NULL

RIGHT JOIN

SELECT *
FROM A
RIGHT JOIN B ON A.key = B.key

RIGHT JOIN (without the intersection of A)

SELECT *
FROM A
RIGHT JOIN B ON A.key = B.key
WHERE B.key IS NULL

FULL JOIN

SELECT *
FROM A
FULL JOIN B ON A.key = B.key

FULL JOIN (without intersection)

SELECT *
FROM A
FULL JOIN B ON A.key = B.key
WHERE A.key IS NULL
OR B.key IS NULL