您的位置:首页 > 其它

OCP 1Z0 051 170

2014-06-01 22:20 176 查看
170. Which two statements are true regarding the DELETE and TRUNCATE commands? (Choose two.)

A. DELETE can be used to remove only rows from only one table at a time.

B. DELETE can be used to remove only rows from multiple tables at a time.

C. DELETE can be used only on a table that is a parent of a referential integrity constraint.

D. DELETE can be used to remove data from specific columns as well as complete rows.

E. DELETE and TRUNCATE can be used on a table that is a parent of a referential integrity constraint

having ON DELETE rule .

A delete一次只能删一个表的数据,当然truncate也只能删一个表

A对B错

C delete只能删除有参照约束中的主表。这显然不对,要先删除子表才能删除主表。

SQL> alter table emp2 add constraints fk_deptno foreign key (deptno) references dept2(deptno);
Table altered

SQL> delete from dept2;
delete from dept2
ORA-02292: integrity constraint (TEST.FK_DEPTNO) violated - child record found

SQL> delete emp2;
14 rows deleted

SQL> delete from dept2;
4 rows deleted


D delete可以只删几列的数据,这当然不可能。

E 不对,delete 可以,truncate不行

SQL> create table dept2 as select * from dept;
Table created

SQL> create table emp2 as select * from emp;
Table created

SQL> alter table dept2 add constraints pk_dept primary key(deptno);
Table altered

SQL> alter table emp2 add constraints fk_deptno foreign key (deptno) references dept2(deptno) on delete cascade;
Table altered

SQL> truncate table dept2;
truncate table dept2
ORA-02266: unique/primary keys in table referenced by enabled foreign keys

SQL> delete dept2;
4 rows deleted
又是一个有误的题

Answer: AE
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: