Home > DeveloperSection > Interviews > What the difference between UNION and UNIONALL?

Posted on    March-24-2012 3:46 AM

 MSSQL Server MSSQL Server 
 2 Answer(s)
  2014  View(s)
Rate this:

Arun Singh

Total Post:310

Posted on    March-24-2012 12:00 AM

Union will remove the duplicate rows from the result set while Union All doesn’t.

Prashant K
Prashant K

Total Post:2

Posted on    May-11-2012 12:00 AM

Both commands combines the tables with common fields except ‘UNION’ displays all the rows from objects without looking at duplicate records whereas ‘UNION ALL’ looks for it and displays only unique records. Thus ‘UNION’ it slower than ‘UNION ALL’

Don't want to miss updates? Please click the below button!

Follow MindStick