Oracle set operation combines two or more result sets into one result set. Result set operations include:
- INTERSECT (intersection) returns the records that are common to the two queries. Select deptno from dept intersect select deptno from emp;
- Union all (UNION set) returns ALL records of each query, including duplicate records. Select deptno from dept union all select deptno from emp;
- UNION (UNION) returns all records of each query, excluding duplicate records. Select deptno from dept UNION select deptno from emp;
- MINUS returns the records retrieved from the first query MINUS the records retrieved from the second query. Select deptno from dept minus select deptno from emp;
When using the set operation, note: the number of columns returned by the query and the column type must be matched, and the column names can be different.
For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12