External and internal database connections

Source: Internet
Author: User

The connections in SQL statements include external connections, internal connections, and full connections.

Internal Connection:

The connection result contains only rows that meet the connection conditions. Both tables involved in the connection must meet the connection conditions.

The connection result contains not only the rows that meet the connection conditions, but also the rows that do not meet the conditions. Including left outer connection, right outer connection, and full outer connection.


Left Outer Join:

All data rows in the left table are retained, and rows in the right table that meet the connection conditions are retained.

The left join keyword returns all rows from the LEFT table (table_name1), even if no matching row exists in the right table (table_name2.

Outer right connection:

All data rows in the right table are retained, while rows in the left table that meet the connection conditions are retained.

The right join keyword returns all rows from the RIGHT table (table_name2), even if no matching row exists in the left table (table_name1.

All external connections:

Left outer join union right Outer Join


Right outer join or right join


Right join or right outer join.
The right outer join is the reverse join of the left Outer Join. All rows in the right table are returned. If a row in the right table does not match a row in the left table, a null value is returned for the left table.
All external connectionsFull outer join or full join


 
INNER JOIN
The inner join must both meet the conditions.

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.