SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Takes Query Plan Analysis and Performance Monitoring to a New Level

UNION and UNION ALL

UNION is an elegant bit of TSQL, allowing you to to combine (stack) result sets together into one. We've put together some examples to show you the difference between UNION and UNION ALL, and we'll look at changing the column names in the first select in order to set the column names of the final result set.

Duration:
3 mins 33 secs
Skill Level:
100
Rating:
4.49 out of 5
Publish Date:
November 28, 2010
UNION and UNION ALL You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of Andy Warren
Andy Warren is a software trainer focusing on SQL Server, a member of the PASS Board of Directors, and a principal in this site - SQLShare.com.

References



Comments
Brian Chappell on 12/2/2010
Great snippet, very well presented. Great stuff!

Tom Hamilton on 12/2/2010
Very good - thank you

Jason Corley on 12/2/2010
Nice, I never considered Union/Union All for performance reasons.

Philip Hickey on 12/2/2010
Great video Andy - thanks

Kevin MacKay on 12/2/2010
Another great video Andy...you're right about the Sales people too :)

Rubens on 12/2/2010
Really liked the note about making a comment beside the UNION, very handy.

BABDE9F59F on 12/2/2010
This is the 1st sql video I've watched. Clear & to the point w/o fluff. Thank you!

Larry Beals on 12/2/2010
One of those little things where we have always used UNION ALL but had no idea why we did it.

Joe on 12/2/2010
Another good presentation, Andy, Kudos!

Nate on 12/2/2010
Always good to get back to the basics and remind yourself how things work.

Joyce Scarlatelli on 12/2/2010
Great! I didn't know/think about the performance between UNION and UNION ALL.

A Ranjan on 12/2/2010
Great!

Sainey M. Drammeh on 12/2/2010
Thanks for all the videos.

Jamshid Nouri on 12/2/2010
excellent

Bobby on 12/2/2010
Execellent! Thanks!

Nilesh on 12/2/2010
good video liked it

Bridget on 12/2/2010
great example

Gilles Despaties on 12/2/2010
Thanks !!! I don't use this offten. However, I am now wiser in its use.

Bruce Bealer on 12/2/2010
I did not know about the column naming. Good Tip

4A5ADA4D6E on 12/2/2010
Thanks for that information I will start adding comments too!

Derek on 12/3/2010
This was very useful--I didn't know that UNION was more CPU intensive than UNION ALL

Mat on 12/8/2010
great

Mohamed Irshad on 12/13/2010
learnt the difference between union and union all today. Thank you

Maurice Ivory on 6/20/2011
I found alot of usefull information in the Unions. An easy way to remove dups.



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions