CONNECT BY如何在ORACLE中工作? [英] how CONNECT BY work in ORACLE?

查看:64
本文介绍了CONNECT BY如何在ORACLE中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解CONNECT BY如何在下面工作:



I'm not able to understand how CONNECT BY is working below:

SELECT employee_id, last_name, manager_id
   FROM employees
   CONNECT BY PRIOR employee_id = manager_id;





EMPLOYEE_ID LAST_NAME MANAGER_ID

---- ------- ------------------------- ----------

101 Kochhar 100

108 Greenberg 101

109 Faviet 108

110陈108

111 Sciarra 108

112 Urman 108

113 Popp 108

200 Whalen 101



根据我的理解CONNECT BY子句指定父级行和层次结构的子行之间的关系。





EMPLOYEE_ID LAST_NAME MANAGER_ID
----------- ------------------------- ----------
101 Kochhar 100
108 Greenberg 101
109 Faviet 108
110 Chen 108
111 Sciarra 108
112 Urman 108
113 Popp 108
200 Whalen 101

As per my understanding The CONNECT BY clause specifies the relationship between parent rows and child rows of the hierarchy.

CONNECT BY <child_value> = <parent_value>





PRIOR运算符引用父行。能告诉我这是怎么回事吗?我们如何得到这个输出?谢谢。



PRIOR operator to refer to the parent row. Could you please let me know how this is working? how we get this output? Thank you.

推荐答案

关于CONNECT BY的好解释:



http://welcometooracle.wordpress。 com / 2012/10/18 / hierarchical /

http://stackoverflow.com/questions/11132375/connect-by-in-oracle-sql
Nice explanation about CONNECT BY:

http://welcometooracle.wordpress.com/2012/10/18/hierarchical/
http://stackoverflow.com/questions/11132375/connect-by-in-oracle-sql


这篇关于CONNECT BY如何在ORACLE中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆