All Products
Search
Document Center

Set operators

Last Updated: Jun 18, 2021

A set operator merges two query results into one result. The queries that contain set operators are compound queries.

Operator

Return value

UNION

Returns all the distinct rows that are selected by a query.

UNION ALL

Returns all the rows that are selected by a query. The return result includes all the duplicates.

INTERSECT

Returns all the distinct rows that are selected by both queries.

MINUS

Returns all the distinct rows that are selected by the first query. The return result excludes the rows that are included in the result of the second query.

For more information and examples about the set operators, see the descriptions of the UNION ALL, INTERSECT, and MINUS operators in the Queries and subqueries topic.