start with

View the Exhibit and examine the details of the EMPLOYEES table.
Evaluate the following SQL statements:
Statement 1:
SELECT employee_id, last_name, job_id, manager_id
FROM employees
START WITH employee_id = 101
CONNECT BY PRIOR employee_id = manager_id AND manager_id != 108 ;
Statement 2:
SELECT employee_id, last_name, job_id, manager_id
FROM employees
WHERE manager_id != 108

START WITH employee_id = 101
CONNECT BY PRIOR employee_id = manager_id;
Which two statements are true regarding the above SQL statements? (Choose two.)

A. Statement 2 would not execute because the WHERE clause condition is not allowed in a statement that
has the START WITH clause.
B. The output for statement 1 would display the employee with MANAGER_ID 108 and all the employees
below him or her in the hierarchy.
C. The output of statement 1 would neither display the employee with MANAGER_ID 108 nor any
employee below him or her in the hierarchy.
D. The output for statement 2 would not display the employee with MANAGER_ID 108 but it would display
all the employees below him or her in the hierarchy.
Answer: CD

SQL> select lpad(ename,length(ename)+level,'*')  A from emp start with ename='JONES' connect by prior
 empno=mgr;

A
--------------------
*JONES
**SCOTT
***ADAMS
**FORD
***SMITH

 

SQL> select lpad(ename,length(ename)+level,'*')  A from emp start with ename='JONES' connect by prior
 empno=mgr and mgr!=7566 ;

A
--------------------
*JONES

 

SQL> select lpad(ename,length(ename)+level,'*') A  from emp where  mgr!=7566 start with ename='JONES'
 connect by prior empno=mgr  ;

A
--------------------
*JONES
***ADAMS
***SMITH

 由此可见connect 中mgr!=7566是剪分支,而where中的 mgr!=7566是剪节点

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值