Guided Notes
Unions
Stacking results vertically with UNION and UNION ALL.
JOIN vs. UNION
Slide 1 / 5JOINs combine tables horizontally β adding columns from a second table to each row.
UNION combines results vertically β stacking the rows of one query underneath the rows of another.
Use a JOIN when two tables describe the same thing (a file and its license). Use a UNION when two tables hold the same kind of thing (stories and comments are both posts).
