Oracle outer JOIN Implementation code _oracle

Source: Internet
Author: User
1. Left OUTER JOIN: External Association
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);
Equivalent to
SELECT E.last_name, e.department_id, D.department_name
From Employees e, departments D
WHERE e.department_id=d.department_id (+);
The result is a record of all employees and corresponding departments, including employee records with no corresponding department number department_id.
2. Right OUTER JOIN: left-Outer association
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);
Equivalent to
SELECT E.last_name, e.department_id, D.department_name
From Employees e, departments D
WHERE e.department_id (+) =d.department_id;
The results are: Records of all employees and corresponding departments, including departmental records without any employees.
3. Full OUTER JOIN: Total External Association
SELECT E.last_name, e.department_id, D.department_name
From Employees E
Full OUTER JOIN Departments D
On (e.department_id = d.department_id);
The results are: Records of all employees and corresponding departments, including employee records with no corresponding department number department_id, and departmental records without any employees.
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.