Flatten Adjacency List Hierarchy To A List Of All Paths

前端 未结 4 1341
梦如初夏
梦如初夏 2020-12-13 01:14

I have a Table that stores Hierarchical information using the Adjacency List model. (uses a self referential key - example below. This Table may look familiar):

<         


        
4条回答
  •  借酒劲吻你
    2020-12-13 01:49

    Traversing a tree of arbitrary depth generally involves recursive procedural code, unless you make use of the special features of some DBMS.

    In Oracle, the CONNECT BY clause will permit you to traverse the tree in depth first order if you use adjacency list, as you did here.

    If you use nested sets, the left sequence number will provide you with the order to visit the nodes.

提交回复
热议问题