• OCP-1Z0-新051-61题版本-19


    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:

    INSERT INTO (SELECT department_id, department_name, location_id
       FROM departments WHERE location_id < 2000)
       VALUES (9999, 'Entertainment', 2500);

    However, the following statement is illegal because it contains the WITH CHECK OPTION clause:

    INSERT INTO (SELECT department_id, department_name, location_id
       FROM departments WHERE location_id < 2000 WITH CHECK OPTION)
       VALUES (9999, 'Entertainment', 2500);
         *
    ERROR at line 2:
    ORA-01402: view WITH CHECK OPTION where-clause violation


    E,(department_id = 20 AND department_id = 50) 这里错误。

    C,缺少WITH CHECK OPTION


  • 相关阅读:
    更改开机密码导致的sql服务启动失败!
    读书:我编程我快乐(一.3)
    读书:我编程我快乐(一.4)
    C#中刷新页面的方式
    VSS 2005 安装,配置简明手册 及VSS2005下载地址
    VSS2005使用手册
    让你少奋斗10年的工作经验
    Tomcat jdk配置及内存设置
    常用的正则表达式
    HTTP Status 403 Access to the requested resource has been denied
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316229.html
Copyright © 2020-2023  润新知