Description:
In this video, I dive into the world of T-SQL by exploring 'UNION' and 'UNION ALL', two powerful set operators that often confuse even experienced SQL Server users. I walk you through creating sample tables to demonstrate how these operators work, emphasizing their unique behaviors and performance implications. By examining query plans and running various examples, we uncover why 'UNION' deduplicates rows while 'UNION ALL' preserves all duplicates, and how the order of operations can affect performance. If you're looking to deepen your understanding of T-SQL and SQL Server internals, this video is a great starting point. Don't miss out on my presale offer for the full course, which will be released after summer and comes with advanced material not covered here. Join me in the next video where we'll continue our exploration into set operators like 'INTERSECT' and 'EXCEPT'.
CHAPTERS
00:00:03 - Introduction and Presale Price
00:01:08 - Creating Tables and Query Plans
00:02:00 - Union and Deduplication
00:03:05 - Query Plan Analysis for Union
00:04:38 - Distinctification and Performance Considerations
00:06:11 - Union All and Duplicates
00:07:15 - Conclusion and Next Video
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? TRAINING & COURSES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Get AI-Ready With Erik
https://training.erikdarling.com/get-ai-ready-with-erik?coupon=AIREADY
SQL Server Performance Engineering Course
https://training.erikdarling.com/sql-server-performance-engineering?coupon=ENGINEERING
Learn T-SQL with Erik
https://training.erikdarling.com/learn-t-sql-with-erik?coupon=ADVANCEDTSQL
Everything Bundle:
https://training.erikdarling.com/?coupon=SPRINGCLEANING
━━━━━━━━━━━━━━━━━━━━━━━━━━
????️ CONSULTING & SERVICES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Need SQL Server performance help?
https://training.erikdarling.com/sqlconsulting
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? CONNECT
━━━━━━━━━━━━━━━━━━━━━━━━━━
Ask questions at Office Hours
https://erikdarling.com/officehours/
Become a channel member
https://www.youtube.com/@ErikDarlingData/join
━━━━━━━━━━━━━━━━━━━━━━━━━━
Share this link via
Or copy link















































