Combining Tables (SQL) Flashcards
Union
Combines one table to the bottom of another table. Ensure that the columns are in the same order for both tables.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/
Inner Join
Place one table ‘next’ to another with values matched by a common dimension.
Remove all rows where the joining dimension’s do not exist in either table.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/
Left Join
Place one table ‘next’ to another with values matched by a common dimension.
Remove all rows where the joining dimension’s do not exist in the table to the LEFT of the join statement. Use NULLs for values in the table to the right of the join, if there is no match.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/
Right Join
Place one table ‘next’ to another with values matched by a common dimension.
Remove all rows where the joining dimension’s do not exist in the table to the RIGHT of the join statement. Use NULLs for values in the table to the left of the join, if there is no match.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/
Full (outer) Join
Place one table ‘next’ to another with values matched by a common dimension.
Use NULLs for values in either table if there is no match.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/
Cross (Cartesian) Join
Combine every combination of the two tables values; where the number of total rows equal to the number of rows in table 1 multiplied by the number of rows in table 2.
https://dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/