SQL SET Operators
Advertisements
SQL SET Operators
SQL SET Operators are behave same like mathematical sets, these sql set operators are classified into four types, which is given below;
- Union
- Union all
- Minus
- Intersect
Union
Union operator return all the value from all the table excluding dublicate values, it means it not return dublicate values.
Example
SELECT emp_id FROM Employee UNION SELECT emp_id FROM Payment
Union all
Union all operator returns all the value from all the table including dublicate values.
Example
SELECT emp_id FROM Employee UNION ALL SELECT emp_id FROM Payment
Intersect
Intersect operator return the common value from all the varibles.
Example
SELECT emp_id FROM Employee INTERSECT SELECT emp_id FROM Payment
Minus
Minus operator return the value which are not available in first table but not available in second table.
Example
SELECT emp_id FROM Employee MINUS SELECT emp_id FROM Payment
Google Advertisment