SQL Joins CheatSheet

Posted on

Estimated reading time: 0 minutes, 55 seconds

This is one of the quickest SQL desk side notes for web developers and php programmers. Simple examples for all types of SQL Joins, such as Left Join, Inner Join, Full Outer Join, and Right Join variations.

SQL Joins

Download the PDF

Transcribed SQL Joins

SELECT <select_list>
FROM TableA A
LEFT JOIN TableB B 
ON A.Key = B.Key
SELECT <select_list>
FROM TableA A
LEFT JOIN TableB B
ON A.Key = B.Key 
WHERE B.Key IS NULL
SELECT <select_list>
FROM TableA A
FULL OUTER JOIN TableB B
ON A.Key = B.Key
SELECT <select_list>
FROM TableA A
INNER JOIN TableB B
ON A.Key = B.Key
SELECT <select_list>
FROM TableA A
FULL OUTER JOIN TableB B
ON A.Key = B.Key
WHERE A.Key IS NULL
OR B.Key IS NULL
SELECT <select_list>
FROM TableA A
RIGHT JOIN TableB B
ON A.Key = B.Key
WHERE A.Key IS NULL
SELECT <select_list>
FROM TableA A
RIGHT JOIN TableB B
ON A.Key = B.Key
Web Development
  1. Barry says:

    These are called joins, not joints https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=sql+joints, great article though besides that!

  2. Peter says:

    @barry, thanks for letting us know. The designer didn’t double check the final PDF with the developers 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top