Oracle joint query-natural connection/external connection/internal connection

Source: Internet
Author: User
If the using keyword is used and the select result list item contains the keyword specified by the using keyword, do not

If the using keyword is used and the select result list item contains the keyword specified by the using keyword, do not

Natural connection

Select *

From r1 natural [inner] join r2 natural [inner] join r3

Where P;



Select A1, A2

From r1

Natural [inner] join
R2, r3 where r2.A = r3. B;

In the natural connection, all columns with the same attribute name in the matching relationship (relation, table) only keep the tuples with the same attribute name (tuple, the order of the attributes: first, list the same attributes in the two relationships, and then list those attributes that only exist in the first relationship, the final output only contains attributes in the second link.

In order to develop the advantages of natural connections and avoid the danger of unnecessary equal attributes, SQL allows users to specify the columns to be equal:

Select *

From r1 [inner] join r2 using (attri_name );

Note:

1. If the using keyword is used and the select result list item contains the keyword specified by the using keyword, do not specify the table to which the keyword belongs in the select result list.

2. Only one column name can be used in using.

3. The natural join keyword and using keyword are mutually exclusive, that is, they cannot appear at the same time.

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.