Interview › UNION vs UNION ALL

SQL interview: UNION dedupes, UNION ALL does not

Stacking UK and IE customers: ALL if you already know they are disjoint. UNION if you do not.

Prompt. One list of emails from Customers and from a leads extract, no duplicates.

Hint: UNION (not ALL) or UNION ALL + DISTINCT

UNION sorts/hashes to dedupe. On two huge disjoint sets, ALL and say so.

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free