Home > Database > Mysql Tutorial > Oracle简单树查询

Oracle简单树查询

WBOY
Release: 2016-06-07 15:02:44
Original
1213 people have browsed it

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 Oracle简单树查询 --oracle针对树型结构的查询 select lpad('-', level, '-') || ename from emp start with (ename = 'KING') connect by prior empno = mgr; 查询结果基于emp表中数据以树形结构显

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

  Oracle简单树查询

  --oracle针对树型结构的查询

  select lpad('-', level, '-') || ename from emp

  start with (ename = 'KING')

  connect by prior empno = mgr;

  查询结果基于emp表中数据以树形结构显示:

  LPAD('-',LEVEL,'-')||ENAME

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

  -KING

  --JONES

  ---SCOTT

  ----ADAMS

  ---FORD

  ----SMITH

  --BLAKE

  ---ALLEN

  ---WARD

  ---MARTIN

  ---TURNER

  ---JAMES

  --CLARK

  ---MILLER

Oracle简单树查询

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template