A data analyst stores each month's e-commerce transactions in separate tables (sales_2025_m01 and sales_2025_m02). The two tables have identical column names and data types. The analyst must write one query that appends the February rows directly beneath the January rows, preserves any duplicate transaction records for later quality checks and runs as fast as possible on tens of millions of rows. Which SQL set operator best satisfies these requirements?
UNION ALL vertically combines the result sets from two SELECT statements without performing the expensive duplicate-removal step that UNION performs. Because it skips the distinct sort/compare phase, UNION ALL is usually the fastest method for appending large tables and it keeps every row-including duplicates-exactly as required. UNION would drop duplicates and add extra processing overhead, while INNER JOIN and FULL OUTER JOIN merge rows horizontally rather than stack them, so neither accomplishes a true append.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why is UNION ALL faster than UNION?
Open an interactive chat with Bash
What is the key difference between a vertical and horizontal combination of tables?
Open an interactive chat with Bash
When should you use INNER JOIN instead of UNION ALL?
Open an interactive chat with Bash
CompTIA Data+ DA0-002 (V2)
Data Acquisition and Preparation
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .