In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "mysql how to achieve self-join query", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "mysql how to achieve self-join query" this article.
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. Represents the leadership table ON employee.mgr = manager.id # employee's mgr points to the superior id # table aliases do not add "", give the column aliases, you can use "", column aliases do not use "", but to avoid including spaces and other special symbols. The above is all the contents of the article "how to implement self-join query in mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.