Set operation in MYSQL by R4R Team

What is SET operation:
Set operations are UNION,INTERSECTION,SET DIFFERENCE etc.

Condition to perform Set operation on two tables:
-Both the table have same number of columns.
-Both tables have same column name.

Example:
We have two tables:


UNION:
It return the all Distinct record from both the table.
Syntax:
SELECT * FROM table1 UNION table2;



INTERSECTION:
It return the all common record from both the table.
Syntax:
SELECT * FROM table1 INTERSECTION table2;




Leave a Comment: