ocp考试资料群:569933648 验证码:ocp ocp 12c 19c考试题库解析与资料群:钉钉群号:35277291
全部博文(486)
分类: oracle
2019-12-17 10:39:30
choose two
examine this sql statement:
delete from employees e
where exists
(select 'dummy'
from emp_history
where employee_id = e.employee_id)
which two are true?
a) the subquery is executed for every row in the employees table.
b) the subquery is not a correlated subquery.
c) the subquery is executed before the delete statement is executed.
d) all existing rows in the employeee table are deleted.
e) the delete statement executes successfully even if the subquery selects multiple rows.
answer::ae
(解析:这又是一个关联子查询的考题,出现过多次,a 答案大家要注意。)
关联子查询:
1、 先执行主查询,对于主查询返回的每一行数据,都会造成子查询执行一次
2、 然后子查询返回的结果又传给主查询
3、 主查询根据返回的记录做出判断
)
注意这道题答案 e 是对的,与前面第 14 题的答案 d 上有区别,要分别对待。
create table emp2 as select * from emp where deptno=20;
update emp2 set empno=7934 where ename=’scott’;
delete from emp e
where exists
(select 'empno'
from emp2
where empno = e.empno);
update emp e
set ename =
(select ename
from emp2
where empno = e.empno);