Set operators
Union
Intersect
Except
Tables:
EMP1
UNION :
union
select * from Emp2
it will give the results from both the tables with matched and unmatched records
Result
select * from Emp1
EXCEPT
select * from Emp2
Result:
Classif_ID Classification
1 Pop
2 Country
3 Alternative
4 Metal
EXCEPT
Classif_ID Classification
7 cad
8 auto
Union
Intersect
Except
Tables:
EMP1
Classif_ID Classification
1 Pop
2 Country
3 Alternative
4 Metal
7 cad
8 auto
EMP2
Classif_ID Classification
5 cad
6 auto
1 Pop
2 Country
3 Alternative
4 Metal
select * from Emp1
union
select * from Emp2
it will give the results from both the tables with matched and unmatched records
Result
Classif_ID Classification
1 Pop
2 Country
3 Alternative
4 Metal
5 cad
6 auto
7 cad
8 auto
INTERSECT:select * from Emp1
EXCEPT
select * from Emp2
Result:
Classif_ID Classification
1 Pop
2 Country
3 Alternative
4 Metal
EXCEPT
select * from Emp1
EXCEPT
select * from Emp2
ResultClassif_ID Classification
7 cad
8 auto
No comments:
Post a Comment