In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Mysql how to achieve table join (including left, right, inner, full join), first of all need to appear in the query of the join of two tables, the following examples to explain the differences between various join queries.
Table an and table b are shown below
Table a contains abcd
There is abcf in table b
Internal connection:
SELECT * from an INNER JOIN b on a.name=b.id
Get the result as shown in the figure, select the equivalent result (abc)
Left connection:
SELECT * from a left JOIN b on a.name=b.id
The query result is shown in the figure, and table an is selected as the benchmark. (abcd)
Right connection:
SELECT * from a right JOIN b on a.name=b.id
The query result is shown in the figure, and table an is selected as the benchmark. (abcf)
Full connection: mysql does not support full connection (full join), you can use left join+ union+right join
(SELECT * from a left JOIN b on a.name=b.id) UNION (SELECT * from a RIGHT JOIN b on a.name=b.id)
The result is that all are displayed, as shown in the following figure:
These are the details about how mysql implements table joins (including left, right, inner, and full joins). If you want to know more, please follow other related articles!
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: 0
*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.