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
What is a table in a database?
What is the purpose of the sql select top clause?
what is commit? : Sql dba
how can we find the number of rows in a table using mysql? : Sql dba
Which software is used for pl sql programming?
What is the command used to fetch first 5 characters of the string?
what is a trigger in mysql? : Sql dba
GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?
How do you take the union of two tables in sql?
What is cte?
Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com
What are the two different parts of the pl/sql packages?
Mention what are different methods to trace the pl/sql code?
what are all types of user defined functions? : Sql dba
How do I remove sql developer from windows 10?