QUESTION NO: 19
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
答案解析:
智力主要注意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:
However, the following statement is illegal because it contains the WITH CHECK OPTION clause:
E,(department_id = 20 AND department_id = 50) 这里错误。
C,缺少WITH CHECK OPTION
本文探讨了如何正确使用SQL INSERT语句向EMPLOYEES表中插入数据,并通过具体示例对比了多个选项,最终确定了一个包含WITH CHECK OPTION子句的有效INSERT语句。
2856

被折叠的 条评论
为什么被折叠?



