Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the difference between union and union all

Answer Posted / vibha kant pandey

Hi friends check it this may help you all.

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.

A UNION statement effectively does a SELECT DISTINCT on the
results set. If you know that all the records returned are
unique from your union, use UNION ALL instead, it gives
faster results.

Example :-
Table X contain values(a,b,c) and Table Y
contain values(c,d,e)
In Case Of Union we will get Result-a,b,c,d,e
and other hand (Union All ) we will get-a,b,c,c,d,e.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of triggers exist in pl/sql?

1011


What are the types of variables use in pl sql?

972


What are system versioned tables?

969


Do we need to create index on primary key?

858


when MSQL8.0 is in market

2016


Is sql harder than python?

1039


What is sqlcontext?

990


Write a sql query to get the third highest salary of an employee from employee_table?

1029


what is log shipping? : Sql dba

1058


explain the advantages and disadvantages of stored procedure? : Sql dba

957


Is stored procedure faster than query?

915


What are the disadvantages of not performing database normalization?

1097


what are the system privileges that are required by a schema owner (user) to create a trigger on a table?

1005


Enlist some predefined exceptions?

998


What is a sql driver?

943