【OCP最新题库解析(052)–题44】USER1.EMP has a referential integrity
- 2019 年 10 月 8 日
- 筆記
该系列专题为2018年4月OCP-052考题变革后的最新题库。题库为小麦苗解答,若解答有不对之处,可留言,也可联系小麦苗进行修改。
注:OCP-052最新题库完整详细解答版请联系小麦苗私聊。解题不易,请大家尊重原创。
QQ:646634621
QQ群:547200174、618766405
微信号:lhrbestxh
Q
题目
USER1.EMP has a referential integrity constraint defined on EMP.DNO that references USER1.DEPT.DNO.
USER1 executes these commads:
SQL> UPDATE dept SET loc='UK' where dno=1;
1 row updated.
SQL>UPDATE emp SET sal=1000 where eno=100;
1 row updated.
SQL>ALTER TABLE dept DROP(dno);
What will be the outcome and why?
A. It will fail because a referential integrity constraint is defined on USER1.EMP
B. It will execute successfully and drop DEPNT.DNO.
C. It will fail because there is an uncommitted transaction on USER1.DEPT.
D. It will execute successfully and drop the DEPT.DNO and EMP.DNO columns.
E. It will fail because there is an uncommitted transaction on USER1.EMP
A
答案
Answer:A
外键(FOREIGN KEY),引用完整性约束(a referential integrity constraint),指明一个列或者列的组合作为一个外键,并且在相同表或者不同表的主键或者唯一键和外键之间建立一个关系。前提是被引用的外键必须是另外一个表的主键。
SCOTT@OCPLHR1> ALTER TABLE dept DROP(deptno);
ALTER TABLE dept DROP(deptno)
*
ERROR at line 1:
ORA-12992: cannot drop parent key column