What is the difference between UNION and UNIONALL?

Answer Posted / amit dixit

Just Above is OK except UNION ALL result modified..
Example:
Table 1 : First,Second,Third,Fourth,Fifth
Table 2 : First,Second,Fifth,Sixth

Result Set:
UNION: First,Second,Third,Fourth,Fifth,Sixth (This will
remove duplicate values)
UNION ALL:
First,First,Second,Second,Third,Fourth,Fifth,Fifth,Sixth
(This will repeat values)

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is optimization and its types?

539


Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

539


What is the difference between dataadapter and datareader?

543


How do I create a partition table in sql server?

499


What is the difference between cartesian product and cross join?

482






How can we determine what objects a user-defined function depends upon?

524


What is the difference between rank and dense_rank?

507


What is the exact numeric data type in sql?

551


While you are inserting values into a table with the insert into .. Values option, does the order of the columns in the insert statement have to be the same as the order of the columns in the table?

623


Explain partitioned view?

592


Explain the difference between functions and stored procedures in sql server?

482


What is a user-defined function in the sql server and what is its advantage?

620


What is a constant or literal in ms sql server?

603


Is it safe to delete log files?

527


What the different types of Replication and why are they used?

546