What is the difference between UNION and UNION ALL?
Model answer
UNION combines results and removes duplicates, which needs extra work. UNION ALL keeps all rows and is faster. Both need the same number of compatible columns. Use UNION ALL unless you need deduplication.
Learn this topic
SELECT, FROM and WHERE: Your First Queries in the course SQL for Beginners: Learn Databases Step by Step.
Sign in to add your own answer.