Search:     Advanced search
Browse by category:
C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers

What is the difference between UNION and UNION ALL?

Add comment
Views: 60
Votes: 0
Comments: 0
UNION
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.

UNION ALL
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.
Others in this Category
document Q: Can a view be updated/inserted/deleted? If Yes under what conditions ?
document What’s the difference between a primary key and a unique key?
document What is Row_Number()?
document Which are new data types introduced in SQL SERVER 2008?
document Q: What is difference between TRUNCATE & DELETE ?
document What is Difference between Function and Stored Procedure?
document What is SQL Server Agent?
document What is Filtered Index?
document What are the basic functions for master, msdb, model, tempdb and resource databases?
document What do you mean by Table Sample?
» More articles



RSS