MySQL left connection and right connection

Source: Internet
Author: User

Http://www.cnblogs.com/zzwlovegfj/archive/2012/06/23/2559593.html

******************************************************************

Left JOIN connection:

Select column 1, column 2, column n from

TableA left join TableB

On tableA. Column = TableB. Column (Normal is a foreign key column) [Here the table is connected to a large table, completely as a plain watch]

Where,having,group by ... Write as usual.

Right connection:

Select column 1, column 2, column n from

TableA right join TableB

On tableA. Column = TableB. Column (Normal is a foreign key column) [Here the table is connected to a large table, completely as a plain watch]

Where,having,group by ... Write as usual.

Internal connection:

Select column 1, column 2, column n from

TableA INNER JOIN TableB

On tableA. Column = TableB. Column (Normal is a foreign key column) [Here the table is connected to a large table, completely as a plain watch]

Where,having,group by ... Write as usual.

Left join: That is, the left table as the benchmark, to the right table to find matching data, can not find a match with null.

How to Remember:

1. The left and right connections can be converted to each other

2. You can convert the right connection to left join (and recommend the left join to replace the right connection, the compatibility will be better)

A stand on the left side of B---b stands on the right of a

A LEFT JOIN B---> B Right Join a is the same.

Internal connection: Query the left/right side of the data, do not leave the part of the null

The inner join is the intersection of the left and right connections.

Can you find the same set of left and right connections?

Currently MySQL is not available, it does not support external connections, outer joins, can be used to achieve the purpose of union.

MySQL left and right connections

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.