SQL outer JOIN

Source: Internet
Author: User
1. Example table A, Dept Department table

B. Employee table

Deptno corresponds to Dept.id to indicate the department number.

2. LEFT JOIN keyword

Left JOIN

Defined

On the basis of internal connections (e.g.),

Adds the result of the left table's non-conformance to the result set. (Non-conforming results, "Administration Department"). The Right table column is filled with null.

3, right connection. The statement keyword.

Right JOIN

Minor changes

As previously defined, the employee table has a corresponding department, then the right join result is the same as the inner join result. Therefore, an employee record is added. (number 4th)

Employee table, now:

Defined

On the basis of internal connections (e.g.),

Adds the result of the right table's non-conformance to the result set. (Non-conforming results, "employee number 4th"). The left table column is filled with null.

4. Full external connection

Statement keyword

Full JOIN

MySQL is not supported.

Definition: The basis of the inner connection. The non-conforming results of the left and right tables are added to the result set, and the table with NULL is filled in with nulls.

So, MySQL can be implemented with union.

Then look back and compare the left and right connections.

SQL outer JOIN

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.