zoukankan      html  css  js  c++  java
  • 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


  • 相关阅读:
    md转html,并带目录结构
    vue05
    vue04
    mysql索引及调优
    mysql的锁与事务
    python基本数据类型的操作
    redis集群
    docker 学习(四)
    MongoDB基本操作
    MongoDB基础
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316229.html
Copyright © 2011-2022 走看看