MySQL connection query Overview

Source: Internet
Author: User

MySQL join queries are roughly divided into four types. The following describes these four types of MySQL join queries. If you are interested in this, take a look.

MySQL join queries are roughly divided into the following four types:

1. Inner join: the records that match the joined fields in the two tables form a join of the record set.

2. Outer Join: outer left join and outer right join.
Table A and table B on the left join means to link all the records in Table A and the joined fields in Table B with those records in Table A that meet the join conditions., note that the final record Assembly includes all records of Table.
The result of right join A and B is the same as that of left join B and A, that is:

Select A. name B. name From A Left Join B On A. id = B. id

The result is the same as that of Select A. name B. name From B Right Join A on B. id = A. id.

3. full join: retrieve all records of fields with a join relationship between the two tables to form a join of the record set. This does not need to be remembered, as long as the fields in the table mentioned in the query are all taken out, whether or not the join conditions are met, it is of little significance ).

4. No join: You don't need to explain it, that is, you don't have to use the join function, and you also have to say that you are not using the auto join function.

Here is a simple memory method. The difference between the inner and the inner join is that the inner join removes all non-conforming records, while the outer join retains some of them. The difference between outer left join and outer right join is that if A joins B on the left, all records in A are retained in the result. In this case, only records meeting the join condition in B are retained, on the contrary, the right join will not be confused.
 

MySQL sorting usage

Mysql multi-Table query implementation

How to deal with MySQL function creation Problems

Rational configuration of MySQL Open_Table

Optimization instance for MySQL random Query

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.