Oracle_set operator, oracle Operator

Source: Internet
Author: User

Oracle_set operator, oracle Operator
Zookeeper

Oracle_set Operator

① UNION/UNION ALL
The UNION operator returns the UNION of two query result sets. Deduplication for the duplicate parts of the two result sets

Example:
Select id, name
From tableA
Union
Select id, name
From tableB

The union all operator returns the UNION of two query result sets. Duplicate parts of the two result sets are not duplicated.

Example:
Select id, name
From tableA
Union all
Select id, name
From tableB


② INTERSECT

The INTERSECT operator returns the intersection of two result sets.

Example:
Select id, name
From tableA
Intersect
Select id, name
From tableB

③ MINUS

Minus operator: returns the difference set of two result sets.

Example:
Select id, name
From tableA
Minus
Select id, name
From tableB

Note:
1. The column names and expressions in the SELECT list correspond to the number and data type.
2. In addition to union all, the system automatically deletes duplicate records.
3. The system displays the column name of the first query in the output.
4. Except union all, the system automatically sorts the first column in ascending order of the first query.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.