+ 2
What is Union???
7 Respostas
+ 18
Union is used to combine data from different tables..
Union will just combine data from two tables and remove the duplicate records
Union all will combine the data and also keep the duplicate records.
+ 12
What @Pegasus said can be taken as example using set theory as we cannot mention a table here (do visit the course for actual examples)
As he mentioned... In the above example
Union would give {1,2,4,8,16}
Union all would give {1,2,4,8,1,4,8,16}
+ 6
The union can relate to set theory.
A union is basucally represented by a symbol similar to "U" and returns all elements of the 2 overlapping/non-overlapping sets.
For example, if
A={1,2,4,8}
and
B={1,4,8,16}
Note both sets have 8, 1 and 4 in common hence
A(union)B={1,2,4,8,16}
+ 2
give me example??
+ 2
Table 1
Id, Name, city
1. Shaan. Bangalore
2. Shaik. Delhi
Table 2
Id, Name, city
1. Shaan. Bangalore
2. Rohit. Mumbai
if you use 'union' they will 3 row in new table.
Id, Name, city
1. Shaan. Bangalore
2. Shaik. Delhi
2. Rohit. Mumbai
if you use 'union all' they will be 4 rows in new table
Id, Name, city
1. Shaan. Bangalore
2. Shaik. Delhi
1. Shaan. Bangalore
2. Rohit. Mumba
hope this will help you to understand
+ 1
thanks a lot shanawaj
+ 1
you are welcome sanju