当前位置: 代码迷 >> Oracle认证考试 >> constraints的一个有关问题
  详细解决方案

constraints的一个有关问题

热度:865   发布时间:2013-02-26 00:00:00.0
constraints的一个问题!
Q: 96 Which three statements correctly describe the functions and use of
constraints? (Choose three.)

A. Constraints provide data independence.
B. Constraints make complex queries easy.
C. Constraints enforce rules at the view level.
D. Constraints enforce rules at the table level.
E. Constraints prevent the deletion of a table if there are dependencies.
F. Constraints prevent the deletion of an index if there are dependencies.

Answer: C, D, E

这道题目为什么选C、D、E呢,我觉得C不对,A对啊!


------解决方案--------------------------------------------------------
注意 independence和dependencies的区别。
------解决方案--------------------------------------------------------
C. 表上面如果有约束,基于此表的视图一样会有这个约束
是这样吗?
------解决方案--------------------------------------------------------
SQL> create view v1 as select * from emp;

View created.

SQL> insert into v1 (empno) values (7900);
insert into v1 (empno) values (7900)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.PK_EMP) violated


SQL> insert into v1 (empno) values (9999);

1 row created.
------解决方案--------------------------------------------------------
a是说约束保证了数据的独立性。
这不正与约束的作用相反吗。比如外键约束是反映了数据间的依存关系,与独立性正相反。