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 msdb database? : SQL Server Architecture

540


How can you find out how many rows returned in a cursor?

551


What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas

550


What is wide table?

538


What is database dimension? : sql server analysis services, ssas

623






What are the advantages to use stored procedures?

572


What is the simplest way to create a new database in ms sql server?

537


What is BCP? When does it used in sql server 2012?

578


What is b tree index?

512


How to write a query with a right outer join in ms sql server?

479


How to use column default values in insert statements in ms sql server?

530


What are the requirements on sql server network connections?

523


What is the function of sql server agent windows service?

539


What are the five major components of a dbms?

510


What happens if the update subquery returns multiple rows in ms sql server?

589