1Z0-51 第39题 关于multitable INSERT的例子
本帖最后由 biotwang 于 2013-12-19 22:18 编辑39. Evaluate the following command: CREATE TABLE employees(employee_id NUMBER(2) PRIMARY KEY,
last_name VARCHAR2(25) NOT NULL,
department_id NUMBER(2) NOT NULL,
job_id VARCHAR2(8),
salary NUMBER(10, 2));You issue the following command to create a view that displays the IDs and last names of the sales staff IN the organization:CREATE OR REPLACE VIEW sales_staff_vu AS
SELECT employee_id, last_name, job_id
FROM employees
WHERE job_id LIKE 'SA_%' WITH CHECK OPTION;Which two statements are true regarding the above view? (Choose two.)
A. It allows you to insert rows into the EMPLOYEES table .
B. It allows you to delete details of the existing sales staff from the EMPLOYEES table.
C. It allows you to update job IDs of the existing sales staff to any other job ID in the EMPLOYEES table.
D. It allows you to insert IDs, last names, and job IDs of the sales staff from the view if it is used in multitable INSERT statements.
答案: BD
为什么选项D是正确的,实在找不出例子。希望有兴趣的看看: A错误,因为employees表的department_id有非空约束,如果通过视图插入,则department_id列则为空,会报错。
B正确,可以通过视图来删除employees任意行。
C错误,因为有WITH CHECK OPTION,是根据job_id LIKE 'SA_%' 来创建的视图,所以不能更改为不是SA_开头的,但是可以更新为SA_开头的。
D错误,也是因为department_id有非空约束,如果通过视图插入,则department_id列则为空,会报错。
但是可以通过multitable INSERT在视图上插入,所有官方文档有错误?
参考:http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_9014.htm#SQLRF55094
官方文档说明,multitable INSERT 不能用在视图上,故D是错误的。
http://blog.csdn.net/rlhua/article/details/12792647 这道题目在本次考试时又被抽到了。。纠结了下。
我也看了官方说明,不过考题确实很扯~~
页:
[1]