zoukankan      html  css  js  c++  java
  • oracle connect by 和start with

    网上找了个例子 测试了一下 貌似明白了
    create table t2(
    root_id number,
    id number,
    name varchar(5),
    description varchar(10)
    );

    insert into t2(root_id,id,name,description) values(0,1,'a','aaa');
    insert into t2(root_id,id,name,description) values(1,2,'a1','aaa1');
    insert into t2(root_id,id,name,description) values(1,3,'a2','aaa2');
    insert into t2(root_id,id,name,description) values(0,4,'b','bbb');
    insert into t2(root_id,id,name,description) values(4,5,'b1','bbb1');
    insert into t2(root_id,id,name,description) values(4,6,'b2','bbb2');

    1.jpg 

    select * from t2 start with root_id = 0 connect by prior id = root_id
    2.jpg 

    select * from t2 start with id = 1 connect by prior id = root_id;
    3.jpg 


    select * from t2 start with id = 4 connect by prior id = root_id;
    4.jpg 

    select * from t2 start with root_id = 0 connect by id = root_id;

    5.jpg 
    select * from t2 start with id = 1 connect by id = root_id;

    6.jpg 

     
  • 相关阅读:
    保存windows 10的登录界面壁纸
    Python 从剪贴板中生成二维码
    SpringBoot
    IDEA8条配置
    Nodejs-hexoBlog
    Mybatis-Plus
    Javaweb文件上传
    GIt基本语法
    JS常用部分整合
    javaweb-maven学习总结
  • 原文地址:https://www.cnblogs.com/softidea/p/3838705.html
Copyright © 2011-2022 走看看