104. SET OPERATORS

TYPES

Ø  Union
Ø  Union all
Ø  Intersect
Ø  Minus

UNION

This will combine the records of multiple tables having the same structure.

Ex:
     SQL> select * from student1 union select * from student2;

UNION ALL

This will combine the records of multiple tables having the same structure but including duplicates.

Ex:
     SQL> select * from student1 union all select * from student2;

INTERSECT

This will give the common records of multiple tables having the same structure.

Ex:
     SQL> select * from student1 intersect select * from student2;


MINUS

This will give the records of a table whose records are not in other tables having the same structure.

Ex:

     SQL> select * from student1 minus select * from student2;


No comments:

Post a Comment