Oracle Multi-table query inside connection, outer JOIN statement summary

Source: Internet
Author: User

Later, the statement is added to the build table.

Existing two tables, WESTEMP staff table, with (wtdempid,wtdempname,wtddeptid) column, westdept Department table, there (wtddeptid,wtddeptname,wtddeptaddress) Column. Where westemp.wtddeptid can be equal to Westdept.wtddeptid.

1. Cross-connect: (for producing Cartesian product) (two kinds of notation)

1.1 SELECT * FROM Westemp a crosses join Westdept b--Cross join, used to generate Cartesian product
1.2. Select * FROM westemp a,westdept b

2. Natural connection (automatic search for the elimination of Cartesian product conditions)

SELECT * FROM Westemp a natural join westdept b--Natural Connection
3. Inner connection (to eliminate Cartesian product by the specified conditions)

3.1 SELECT * from Westemp a inner join westdept B in a.wtddeptid=b.wtddeptid--inner connection,
3.2 SELECT * from Westemp a joins westdept B on a.wtddeptid=b.wtddeptid--internal connection,

3.3 Select * from westemp a,westdept b where a.wtddeptid=b.wtddeptid--inside connection,

4. Full-Outer connection

SELECT * FROM Westemp a full outer joins westdept B on a.wtddeptid=b.wtddeptid--all-out connections
5. Right outer connection

5.1 Select * FROM westemp a right outer joins westdept B on a.wtddeptid=b.wtddeptid--left outer connection

5.2 Select * from westemp a,westdept b where A.wtddeptid=b.wtddeptid (+)--right outer join

6. Left Outer connection

6.1select * from Westemp a ieft outer join westdept B on a.wtddeptid=b.wtddeptid--left outer connection

6.2select * from westemp a,westdept b where A.wtddeptid (+) =b.wtddeptid--left outer connection

Multi-table Connection definition

Http://www.cnblogs.com/westward/p/5148028.html

Oracle Multi-table query inside connection, outer JOIN statement summary

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.