SQL Tuning Basic Overview 07-sql Joins

Source: Internet
Author: User
Tags joins

N years ago, just when the contact with SQL, is a multi-table query in a variety of internal connections, external connections, left outer connection, right outside the connection of a variety of connections to get dizzy.

What's more, there are two different ways to read the table connections in the book.

For example, the query for table A, table B

1, internal connection two kinds of wording:

SELECT * from A, B where a.id = b.id;

SELECT * from A join B on a.id = b.id;

2, right outer connection notation:

SELECT * from A, B where a.id (+) = b.id;

SELECT * from A right join B on a.id = b.id;

3, LEFT outer connection notation:

SELECT * from A, B where a.id = b.ID (+);

SELECT * from A LEFT join B on a.id = b.id;

The difference between the results of each query is really a painful memory.

Although this knowledge point seems to be easy to understand now, it has caused a lot of confusion for beginners.

And today just see a picture on the Internet, very good description of the different connections, very comprehensive, is the following picture.

I am not a developer, some of these connections I have not used so far, but when I see this diagram, the SQL joins is fully understood.

SQL Tuning Basic Overview 07-sql Joins

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.