MySQL Common basic operation Syntax (ix) ~ ~ Outer JOIN query "command line mode"

Source: Internet
Author: User
Tags benchmark
1, left outside the connection to leave outer join, or leaving Jion,outer can be omitted to write, the bottom of the right connection and full connection is the same:

The left outer join means that the data in the table on the left side of the right join is the benchmark, that is, all the tables in the left must be displayed, such as:

In the first query here, the company table is on the left, so it is based on company, so the results shown are shown in addition to the same 6 data in the company, depart_id the other one that exists in company.
In the second query, the EMP on the left, the EMP as the benchmark, so the results shown in addition to depart_id the same 6, but also the EMP in the presence of another show out.
2, right outside the connection to join:

From the top of the query two queries, except the field order of the different, and left outer JOIN operation is very similar. Only one is based on the table on the left side of the join, and the other is based on the table on the right side of the join. (Some friends say that the performance of the left join is better, this is for the time being, wait until the performance test to say again)
3, fully connected full join, this and the above slightly different is that the syntax is not used behind the join on, the direct Select field name from the tablename1 full join tablename2, and its results will also appear before the Cartesian product phenomenon, This is the display (the number of fields in table 1 plus the number of fields in table two) a field that displays (the number of records in table one multiplied by the number of records in table two) records;

MySQL Common basic operation Syntax (ix) ~ ~ Outer JOIN query "command line mode"

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.