1, intersect operation
Return the same part of the query result both their intersection
Sql> SELECT * FROM ABC
2 intersect
3 SELECT * from ABC2;
2, minus operation
Returns the portion of a row that is not the same as the second query result in the first query result.
Is the difference set of two results
Sql> SELECT * from ABC2
2 minus
3 SELECT * FROM ABC;
3, Union-union all
(1) The Union filters out duplicate records after the table is connected, so the resulting set is sorted after the table is connected, the duplicate records are deleted, and the results are returned.
(2) UNION all simply merges the two results and returns. If there are duplicate data in the two result sets returned, the result set returned contains duplicate data
Note: In terms of efficiency, union All is much faster than union, and if you can confirm that the merged two result sets do not contain duplicate data, use UNION ALL
There are two basic rules for the result set of queries with UNION combinations:
(1) The number of columns in all queries must be the same as the order of the columns.
(2) Data types must be compatible
Union:
Sql> Select D.code,d.name from ABC D
2 Union
3 Select E.code,e.name from ABC3 e;