【2019年8月版】OCP 071认证考试原题-第42题

【2019年8月版】OCP 071认证考试原题-第42题Choose two Examine this SQL statement: DELETE FROM employees e WHERE EXISTS (SELECT 'dummy&apo…

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);

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/10436.html

(0)
上一篇 2022-12-27
下一篇 2022-12-27

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注