Wednesday 8 July 2015

Union Vs UnionAll in Sql server 2008?

Union:-
1. It is used to combine the result set of two or more SELECT statement.
2. Each SELECT statement within the UNION must have the same no of columns.
3. Columns must have the similar data type.
4. Columns in each SELECT statement must be in the same order.
5. Union operator Select distinct value by default.

Union All:-
1. It is used to combine the result set of two or more SELECT statement.
2. Each SELECT statement within the UNION ALL must have the same no of columns.
3. Columns must have the similar data type.
4. Columns in each SELECT statement must be in the same order
5. Union All select all the value i.e Union All will not eliminate duplicate value

No comments:

Post a Comment

Note: only a member of this blog may post a comment.