Thoroughly understand Oracle's left and right outer joins (data speaking) ____oracle

Source: Internet
Author: User
Tags joins

Employees table:

Department Table:

Select E.last_name,e.department_id,d.department_name

From Employees E

LEFT OUTER JOIN Departments D

On (e.department_id = d.department_id);

Select E.last_name, D.department_name

From Employees e, departments D

where e.department_id = d.department_id (+) left outer join

The result is a record of all employees and corresponding departments, including employee records with no corresponding department number department_id.

Select E.last_name,e.department_id,d.department_name

From Employees E

Right OUTER JOIN Departments D

On (e.department_id = d.department_id);

Select E.last_name, D.department_id,d.department_name

From Employees e, departments D

where e.department_id (+) = d.department_id; right outer join

The results are: Records of all employees and corresponding departments, including departmental records without any employees.

Summarize:

Table A right outer join B table

The result is: all B-Table records, and matching A-table records, table A does not match the display null

A (+) =b

A table left OUTER join B

A=b (+)

The result is: All Table A records, and the matching B table records, B table does not match the display null

Classic Summary:

The table with + number does not show all, the table opposite shows all.

formula:

right outer join + on left

LEFT OUTER join + on right

There are + not fully explicit

No + is fully explicit

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.