分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
oracle 9i判断是叶子或根节点,是比较麻烦的一件事情,SQL演示脚本如下:
- DROP TABLE idb_hierarchical;
- create TABLE idb_hierarchical
- (
- id number,
- parent_id number,
- str varchar2(10)
- );
- insert into idb_hierarchical values(1,null,'A');
- insert into idb_hierarchical values(2,1,'B');
- insert into idb_hierarchical values(3,2,'C');
- insert into idb_hierarchical values(4,3,'D');
- insert into idb_hierarchical values(5,2,'E');
- insert into idb_hierarchical values(6,2,'F');
- insert into idb_hierarchical values(7,3,'G');
- insert into idb_hierarchical values(8,4,'H');
- insert into idb_hierarchical values(9,4,'I');
- insert into idb_hierarchical values(10,null,'J');
- insert into idb_hierarchical values(11,10,'K');
- insert into idb_hierarchical values(12,11,'L');
- insert into idb_hierarchical values(13,10,'M');
DROP TABLE idb_hierarchical;create TABLE idb_hierarchical(id number,parent_id number,str varchar2(10));insert into idb_hierarchical values(1,null,'A');insert into idb_hierarchical values(2,1,'B');insert into idb_hierarchical values(3,2,'C');insert into idb_hierarchical values(4,3,'D');insert into idb_hierarchical values(5,2,'E');insert into idb_hierarchical values(6,2,'F');insert into idb_hierarchical values(7,3,'G');insert into idb_hierarchical values(8,4,'H');insert into idb_hierarchical values(9,4,'I');insert into idb_hierarchical values(10,null,'J');insert into idb_hierarchical values(11,10,'K');insert into idb_hierarchical values(12,11,'L');insert into idb_hierarchical values(13,10,'M');
示例数据清单如下:
- SELECT RPAD('+',LEVEL*2+1,'.')||STR STR_LEVEL,ID,PARENT_ID,LEVEL LVL
- FROM idb_hierarchical
- START WITH PARENT_ID IS NULL
- CONNECT BY PARENT_ID = PRIOR ID;
SELECT RPAD('+',LEVEL*<