Learn SQL_ Multiple Tables Cheatsheet _ Codecademy
Learn SQL_ Multiple Tables Cheatsheet _ Codecademy
Multiple Tables
Outer Join
An outer join will combine rows from different tables SELECT column_name(s)
even if the join condition is not met. In a LEFT JOIN ,
FROM table1
every row in the left table is returned in the result set,
and if the join condition is not met, then NULL LEFT JOIN table2
values are used to fill in the columns from the right ON table1.column_name =
table.
table2.column_name;
WITH Clause
UNION Clause
https://www.codecademy.com/learn/learn-sql/modules/learn-sql-multiple-tables/cheatsheet 1/3
06/11/24, 10:57 Learn SQL: Multiple Tables Cheatsheet | Codecademy
Foreign Key
Primary Key
https://www.codecademy.com/learn/learn-sql/modules/learn-sql-multiple-tables/cheatsheet 2/3
06/11/24, 10:57 Learn SQL: Multiple Tables Cheatsheet | Codecademy
Inner Join
The JOIN clause allows for the return of results from SELECT *
more than one table by joining them together with
FROM books
other results based on common column values
specified using an ON clause. INNER JOIN is the JOIN authors
default JOIN and it will only return results matching ON books.author_id = authors.id;
the condition specified by ON .
Print Share
https://www.codecademy.com/learn/learn-sql/modules/learn-sql-multiple-tables/cheatsheet 3/3