Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
UNION is one of SQL’s set operations (UNION, UNION ALL, INTERSECT, EXCEPT/MINUS). It vertically concatenates the results of multiple SELECT statements into a single result set. This question asks if that description is accurate.
Given Data / Assumptions:
Concept / Approach:
Conceptually, UNION stacks result sets. After stacking, UNION applies a duplicate elimination step, while UNION ALL does not. Ordering is optional and, when used, applies to the final combined set via a trailing ORDER BY clause.
Step-by-Step Solution:
Verification / Alternative check:
Compare UNION vs UNION ALL on datasets with duplicates to see the effect on row counts.
Why Other Options Are Wrong:
Common Pitfalls:
Mismatched column counts; forgetting that ORDER BY must reference the combined output; assuming UNION preserves internal ordering of each branch.
Final Answer:
Correct
Discussion & Comments