Oracle Database Basic Learning (vi) subqueries

Source: Internet
Author: User

1, internal connection (equivalent connection)

Example: Connecting a table content to a display

Select *  from where = E.deptno;

Note: The content is displayed only if the D.deptno = E.deptno condition is met, otherwise it is not displayed

2, external connection: Let the equivalent judgment left and right side of the data can be all displayed, using the external connection mode when using "(+)"

Format:

Left outer join: field = field (+)

right outer join: Field (+) = Field

Example: Display the employee's name, position, and leader name

Analysis:

Confirm the data you want to use:

1, the name of the employee of the EMP table, the position (alias is E)

2, the name of the leader of the EMP table (alias m)

Confirm the connected relationship:

E.mgr = M.empno;

If an employee does not have a lead, the content will not be displayed, it is necessary to use an external connection, so that one side of the table in the absence of leadership, can also be displayed.

Left and right outer joins can be indistinguishable, but the most important thing is to display the contents of the display.

Select E.ename, E.job, M.ename  from  where= m.empno (+);

Oracle Database Basic Learning (vi) subqueries

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.