The difference between SQL left link, right link, and full link

Source: Internet
Author: User
Tags joins
Outer joins: Left outer connection, right outer connection, full outer connection
Left outer connection is to left table, to match the right table, the left table has how many data, the result is how many data
SELECT * from A LEFT join B on A.id=b.id
ID name ID
1 a 1
2 b null NULL
4 c null NULL
The right outer connection is connected with the left outer connection, in contrast, to the right table, to match the left table, the right table has how many data, the result is how many data
SELECT * from A right join B on A.id=b.id
ID name ID
1 a 1
Null NULL 3 C
Total outer JOIN Data bar number is not necessarily, quite with is the left outer connection and the right outer joins the synthesis
SELECT * from A full join B on A.id=b.id
ID name ID
1 a 1
2 b null NULL
Null NULL 3 C
4 c null NULL

The difference between SQL left link, right link, and full link

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.