In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "mysql self-join query instance analysis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Self-join query is a special multi-table join query, because the tables of two related queries are the same table, which are virtual into two tables by aliases and then joined.
2. The self-join query is to connect yourself with yourself, give two different aliases to a table, and then attach the connection conditions.
Example
# these data are all in the employee table # treat the t_employee table as both the employee table and the leadership table # the leadership table is a virtual concept We can use aliases to virtual SELECT employee.id "employee's number", emp.ename "employee's name", emp.salary "employee's salary", manager.id "leader's number", manager.ename "leader's name", manager.salary "leader's salary" FROM emp employee INNER JOIN emp manager#emp employee:employee., represents the # emp manager of the employee table: if you use manager. It means that the ON employee.mgr of the leadership table = manager.id # employee's mgr points to the alias of the superior id # table, do not add "", give the column an alias, you can use "", and the alias of the column does not use "", but avoid including special symbols such as spaces. " This is the end of the content of mysql self-join query instance Analysis. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.