Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

UNION vs UNION ALL Usage

EasySQL & Data Manipulation00:00
Practice interviewer
In session
5 left
00:00

Your question is UNION vs UNION ALL Usage. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Context

Combining result sets is common in analytics work, such as merging customer lists from multiple American Express data sources or reporting surfaces. Interviewers ask this to check whether you understand both correctness and performance tradeoffs.

Question

Explain the difference between UNION and UNION ALL in SQL. You should describe how each handles duplicate rows, what requirements the combined queries must satisfy, and when you would choose one over the other in an analytics workflow.

Scope Guidance

Keep your answer practical. A strong response should cover result-set behavior, performance implications, and a simple example of when deduplication is desirable versus when preserving all rows is the correct choice.