您的位置:首页 > 其它

OCP-1Z0-051-2015-19题

2015-06-25 15:43 435 查看
Examine the structure of the EMPLOYEES table:



You want to create a SQL script file that contains an INSERT statement. When the script is run,

the INSERT statement should insert a row with the specified values into the EMPLOYEES table.
The INSERT statement should pass values to the table columns as specified below:



Which INSERT statement meets the above requirements?

A. INSERT INTO employees

VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);

B. INSERT INTO employees

VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid',2000, NULL, &did IN (20,50));

C. INSERT INTO (SELECT *

FROM employees

WHERE department_id IN (20,50))

VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);

D. INSERT INTO (SELECT *

FROM employees

WHERE department_id IN (20,50)

WITH CHECK OPTION)

VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);

E. INSERT INTO (SELECT *

FROM employees

WHERE (department_id = 20 AND

department_id = 50)

WITH CHECK OPTION )
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);

Answer: D

Explanation:在EMPLOYEES 表中插入一条语句,首先字段1  employee_id为自增需要.nextval;字段5 department_id为20或者50所以需要department_id IN (20,50) WITH CHECK OPTION

Using the WITH CHECK OPTION Clause: Example The following statement is legal even though
the third value inserted violates the condition of the subquery 
where_clause
:

with check option可以这么解释:通过视图进行的修改,必须也能通过该视图看到修改后的结果。比如你insert,那么加的这条记录在刷新视图后必须可以看到;如果修改,修改完的结果也必须能通过该视图看到;如果删除,当然只能删除视图里有显示的记录。 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: