-
-
Save sambostock/86d0da9613f41996b2f5 to your computer and use it in GitHub Desktop.
SQL Join Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(-----A-----(-----) B ) | |
SELECT <columns> | |
FROM table_A A | |
LEFT JOIN table_B B | |
ON A.key = B.key | |
(-----A-----( ) B ) | |
SELECT <columns> | |
FROM table_A A | |
LEFT JOIN table_B B | |
ON A.key = B.key | |
WHERE B.key IS NULL | |
( A (-----) B ) | |
SELECT <columns> | |
FROM table_A A | |
INNER JOIN table_B B | |
ON A.key = B.key | |
(-----A-----(-----)-----B-----) | |
SELECT <columns> | |
FROM table_A A | |
FULL OUTER JOIN table_B B | |
ON A.key = B.key | |
(-----A-----( )-----B-----) | |
SELECT <columns> | |
FROM table_A A | |
FULL OUTER JOIN table_B B | |
ON A.key = B.key | |
WHERE A.key IS NULL | |
OR B.key IS NULL | |
( A (-----)-----B-----) | |
SELECT <columns> | |
FROM table_A A | |
RIGHT JOIN table_B B | |
ON A.key = B.key | |
( A ( )-----B-----) | |
SELECT <columns> | |
FROM table_A A | |
RIGHT JOIN table_B B | |
ON A.key = B.key | |
WHERE A.key IS NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment