In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the use of left connection, right connection, inner connection and full connection in Mysql. The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the usage of left connection, right connection, inner connection and full connection in Mysql.
1. Basic definition
Left join (left join): returns records that include all records in the left table and records with equal join fields in the right table.
Right join (right join): returns records that include all records in the right table and records that are equal to the join fields in the left table.
Inner join (equivalent join or inner join): only rows with equal join fields in two tables are returned.
Full join (full external join): returns all records in the left and right table that are equal to the join fields in the left and right table.
Take a chestnut:
Form A, form B
IdnameidA_ idjob1 Xiao Wang 12 teachers 2 Xiao Li 24 programmers 3 Xiao Liu
Inner join: only rows that match between two tables can be displayed
Select a.name,b.job from An an innner join B b on a.id=b.A_id
Result: Mr. Xiao Li
Left join: the table on the left is unrestricted
Select a.name, b.job from An a left join B b on a.id=b.A_id
Result: Xiao Wang null
Miss Xiao Li
Xiao Liu null
Right join: the table on the right is unrestricted
Select a.name, b.job from An a right join B b on a.id=b.A_ia
Result: Mr. Xiao Li
Null programmer
Full connection: there are no restrictions on the left and right tables
Select a.name, b.job from An a full join B b on a.id=b.A_id
Result: Xiao Wang null
Miss Xiao Li
Xiao Liu null
Null programmer
Note: external and external connections in sql include: left connection, right connection, full connection.
Equivalent connection is also called inner connection.
Thank you for your reading, the above is the content of "left connection, right connection, inner connection and full connection in Mysql". After the study of this article, I believe you have a deeper understanding of the usage of left connection, right connection, inner connection and full connection in Mysql, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.