Databases · Junior · Question 31 of 75
What is the difference between UNION and UNION ALL?
- 1
UNIONjoins tables side by side - 2
UNION ALLremoves duplicates - ✓Correct answer:
UNIONremoves duplicate rows (extra work);UNION ALLkeeps all rows
Explanation
Both stack the results of two queries with matching columns. Use UNION ALL when duplicates are impossible or wanted: it's faster.