skip to main content
Operators : Set operators
 

Set operators

Set operators combine the results of two component queries into a single result. Queries containing set operators are called compound queries. The following table describes the supported set operators.
 
Table 9: Set operators 
Operator
Returns
UNION
All rows selected by either query.
UNION ALL
All rows selected by either query, including all duplicates.

Examples

SELECT deptno FROM emp UNION SELECT deptno FROM dept
SELECT deptno FROM emp UNION ALL SELECT deptno FROM dept