Union
UNION stacks results. SELECT name FROM y2024 UNION SELECT name FROM y2025; Unique names from both years. Column count must match. UNION ALL keeps duplicates and is cheaper.
ORDER BY after the last SELECT, in brackets if needed. Types should be compatible (both names, not name vs marks).
Trap — UNION when you needed JOIN. Trap: UNION ALL vs UNION mixed up in a viva.
On the example next to this theory — UNION merges result sets and drops duplicate rows.
Exam tip
SELECT name FROM y2024 UNION SELECT name FROM y2025;