Aug 14 2013

Abhishek Jaiswal

Print this Post

SQL SERVER – Difference Between Union and Union All




The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.




The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.


The difference between Union and Union all is that Union all will not eliminate duplicate rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into a table.

A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it gives faster results.

Abhishek Jaiswal

About Abhishek Jaiswal

Abhishek Jaiswal has Contibuted 325 articles in this blog.

Hobby: reading/writing Knowledge based articles Technology/Skills : ASP.NET, SharePoint, C#, OOPs etc

Permanent link to this article: http://www.zappmania.in/2013/08/14/sql-server-difference-between-union-and-union-all.html


1 ping

Skip to comment form

  1. Download Whatsapp for PC

    always i used to read smaller articles that as well clear their motive, and that is also happening with this article which I
    am reading here.

  2. Malcolm

    Greetings from Florida! I’m bored at work so I decided to browse your
    website on my iphone during lunch break. I love the knowledge you present here and can’t wait to take a look when I get home.
    I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow,
    very good blog!

  3. candy crush cheats

    You’ve made some really good points there. I looked on the internet for more information about the issue and found
    most individuals will go along with your
    views on this web site.

  4. whatsapp for pc

    Terrific article! That is the type of info that are meant to be shared
    around the web. Disgrace on Google for no longer positioning this put up
    higher! Come on over and consult with my site .
    Thanks =)

  5. Abhishek Jaiswal
    Abhishek Jaiswal

    looking forward to see more knowledgeable posts like this…

  6. Abhishek Jaiswal
    Abhishek Jaiswal

    Nice work

  1. URL

    … [Trackback]

    […] Informations on that Topic: zappmania.in/2013/08/14/sql-server-difference-between-union-and-union-all.html/ […]

Leave a Reply