In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What is the principle of Mysql join join query? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Mysql connection (join) query
1. Basic concepts
The result of all rows obtained by "pairwise horizontal docking" for each row of the two tables.
Suppose:
Table A has N1 rows and M1 columns
Table B has N2 rows and m2 columns.
After the "docking" of Table An and Table B, there will be:
N1*n2 Lin
M1+m2 column.
2. The result after they dock (connect) is similar to this:
3. Basic form of join query: from Table 1 [connection method] join Table 2 [on connection conditions] basic form of connection query: from Table 1 [connection method] join Table 2 [on connection conditions]
1. Classification of join queries
Cross connection
In fact, it is the "all data" obtained after the join between two tables according to the basic concept of join, and there is no result of "filtering"-filtering refers to the join condition.
That is, cross connections are "all connections" without conditions-some are called Cartesian products.
Cross-connections are usually of no practical value, because after they are connected, the meaning of each row of data may be "lost".
Form:
From Table 1 [cross] join Table 2
Or:
From Table 1, Table 2
Internal connection
Form:
From Table 1 [inner] join Table 2 on Table 1. Field 1 = Table 2. Field 2
Meaning:
In the result of getting a "cross join", the data of those rows that meet the set join condition (that is, the condition after on)
Cross-connections often have "meaningless data", as follows:
2. See the results of the internal connection:
3. The result is:
4. It can be seen that the internal connection is to find out the "meaningful" data rows in the results of a cross-connection. And a cross-connection, in which the data, some meaningful, some meaningless (wrong data).
However, pay attention to:
1. This connection condition is not set at will, but according to the actual relationship between tables, which usually means that the values of two fields with "primary foreign key relationship" between two tables are equal.
2, it can be seen that the join query has its inherent logical consistency with the "foreign key relationship" we have learned before.
3, however, when we do an internal join, we do not require two tables to have a foreign key relationship-we just realistically understand that they have a foreign key relationship (data relationship). And the use of internal joins in the query establishes their relationship. It can be seen that an internal connection is actually to find out the "meaningful" rows of data in a cross-connected data result. And a cross-connection, in which the data, some meaningful, some meaningless (wrong data).
The answer to the question about the principle of Mysql connection join query is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 283
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.