In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what is self-connection in the Oracle database, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
A self-join is a join to the same table. To have your own self-join, you must use a different table alias to identify each reference to the table in the query. Now consider an example: the store schema contains a table called employees that holds employee information. If the employee has a manager, the manager_id column contains the employee_id of the employee's manager. The employee_id table contains the following rows:
You can see that CEOJames Smith's manager_id is empty, which means he has no manager (only responsible to shareholders). Both Fred Hobbs and Susan Jones work for Ron Johnson.
You can use a self-join to display the name of each employee and its manager. In the following example, the employee table is referenced twice, using two aliases: W and m. The alias w is used to get the employee's name, while the alias m is used to obtain the manager's name, and the self-join is for w.manager_id and m.employee_id:
SELECT W. firstworthy Namell''ll w.last_name II'work for'llm.first_namell' 'llm.last_name
FROM employees w, employees m
WHERE W. managerorganizid.w. Employee_id
W.FIRST_NAMEl I'l IW.LAST_NAME I l 'WORKSFOR' I IM.FIRST_NA
Ron Johnson works forJames Smith
Fred Hobbs works for Ron Johnson
Susan Jones works forRon Johnson
Because the manager_id column for James Smith is empty, no rows are displayed for him.
About what is in the Oracle database since the connection has been shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.