Oracle Learning Path-sql-Join query

Source: Internet
Author: User

One, connection query:

1. Internal connection
The maximum number of connection queries used, only the rows in the table that match the criteria are returned. Such as:

/*** Internal connection ***/select j_c.*,j_sc.* from course j_c INNER join SC j_sc on j_c.cno = J_sc. CNO;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/49/BF/wKioL1QZj53Q4GbiAAEoNHOov9U429.jpg "title=" Internal connection. png "alt=" wkiol1qzj53q4gbiaaeonhoov9u429.jpg "/>

2. Left Outer connection

Left OUTER join: Returns all rows in the left table, in addition to the rows that match the criteria.

/************************** left outer connection **/select j_c.*,j_sc.* from course j_c Ieft join SC j_sc on j_c.cno = J_sc. CNO;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/49/BF/wKioL1QZkEKibcLhAAH9EM-w5hg801.jpg "title=" Left outer connection. png "alt=" wkiol1qzkekibclhaah9em-w5hg801.jpg "/>

3. Right outer connection

Right OUTER join: Returns all rows in the right table, in addition to the rows that match the criteria.

/************************** right outer connection **/select j_c.*,j_sc.* from course j_c R join SC j_sc on j_c.cno = J_sc. CNO;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/49/BD/wKiom1QZkUHTlxEoAAFwxqJ2Atc312.jpg "title=" Right outer connection. png "alt=" wkiom1qzkuhtlxeoaafwxqj2atc312.jpg "/>

4. Full-Outer connection

Full outer joins: Returns rows that do not match the criteria in the left and right tables, in addition to and return rows that meet the criteria

/************************** full outer connection **/select j_c.*,j_sc.* from course j_c Complete join SC j_sc on j_c.cno = J_sc. CNO;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/49/BD/wKiom1QZkbrAluTuAAIzHjwFvGU295.jpg "title=" Full outer connection. png "alt=" wkiom1qzkbralutuaaizhjwfvgu295.jpg "/>

5. Cross-Connect

Cross connection: That is, the non-write connection condition or invalid connection condition forms the Cartesian product. (The default query)

/************************** Cross connect **/select j_c.*,j_sc.* from course J_c crosses join SC j_sc; Select j_c.*,j_sc.* from Course J_c, SC j_sc;


This article is from the "Skyarac" blog, make sure to keep this source http://skyarac.blog.51cto.com/5324985/1554529

Oracle Learning Path-sql-Join 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.