The set operator is specifically used to merge the results of multiple SELECT statements, including: Union,union All,intersect,minus. When using the set operation function, ensure that the data type and number of fields in the dataset are the same.
The use of the set operator requires attention:
- The set operator does not apply to log, Varray, and nested lists.
- The Union, Interesect, and minus operations do not work on long columns.
- If the selection column contains an expression or function, you must define a column alias for the expression or function.
1. UNION
When you use union, the columns that are repeated in the dataset are automatically filtered and sorted in ascending order from the results of the first column.
2. UNION All
The result set contains all the data, does not filter duplicate rows, and does not sort the results.
3, Intersect
The intersection of two result sets is taken, and the results of the first column are sorted in ascending order.
4, minus
Displays only the data that exists in the first collection that does not exist in the second collection, and is sorted in ascending order with the results of the first column.
Oracle's set operation function---minus, union, intersect