您的位置:首页 > 其它

OCP 1Z0 051 38

2014-05-17 17:07 176 查看
38. Which two statements are true regarding views? (Choose two.)

A. A simple view in which column aliases have been used cannot be updated.

B. Rows cannot be deleted through a view if the view definition contains the DISTINCT keyword.

C. Rows added through a view are deleted from the table automatically when the view is dropped.

D. The OR REPLACE option is used to change the definition of an existing view without dropping and re-creating it.

E. The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view.

A

SQL> create or replace view v_t1 as select c as v_c from t1;
View created

SQL> insert into v_t1(v_c) values(2);
1 row inserted

SQL> select * from t1;
C
----------
2
1 row selected


C

SQL> alter table v_t1 add c2 int;
alter table v_t1 add c2 int
ORA-00942: 表或视图不存在

SQL> alter table t1 add c2 int;
Table altered


B

SQL> create or replace view v_t1 as select distinct c as v_c from t1;
View created
Executed in 0.016 seconds

SQL> insert into v_t1(v_c) values(2);
insert into v_t1(v_c) values(2)
ORA-01732: 此视图的数据操纵操作非法


E with check option的用处

SQL> create or replace view v_t1 as select c as v_c from t1 where c <=2 with check option;
View created
Executed in 0.031 seconds

SQL> insert into v_t1(v_c) values(4);
insert into v_t1(v_c) values(4)
ORA-01402: 视图 WITH CHECK OPTION where 子句违规


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