Lesson 21 of 30
Stacking results with UNION
Today at the studio
Kou used to keep two separate lists and paste them together by hand. "I will not do that," you say. Byte, a cat of few words, blinks twice.
The idea
UNION stacks the rows of two queries into one result and removes duplicates. UNION ALL stacks them and keeps every row. Both queries need the same number of columns, in the same order.
INTERSECT keeps only the rows that appear in both queries, and EXCEPT keeps the rows of the first query that are not in the second.
Example
SELECT species FROM characters UNION SELECT genre FROM shows
Your turn
0 of 4 questions
Question 1 of 4
Make one list of every name that belongs to a person on staff or to a character, with no repeats.