zoukankan      html  css  js  c++  java
  • 052-204(新增70题2018)

    iew the Exhibit to see the structure of the EMPLOYEES and DEPARTMENTS tables.
    Your organization plans to dissolve the department with department ID 30. You execute the following command to delete rows from the DEPARTMENTS table:
    SQL> delete from DEPARTMENTS
    where DEPT_ID = 30;
    The command fails and displays the following error:
    ERROR at line 1:
    ORA-02292: integrity constraint (HR.SYS_C005374) violated - child record found
    Which two actions would you take to overcome this error? (Choose two.)
    Exhibit:

    A. alter the foreign key constraint to include the cascade option

    B. alter the foreign key constraint to include the on delete cascade option

    C. first, drop the EMPLOYEES table and then delete the rows from the DEPARTMENTS table

    D. first, drop the DEPARTMENTS table and then delete the rows from the EMPLOYEES table

    E. first, delete all of the rows from EMPLOYEES table and then delete the rows from the DEPARTMENTS table for department id 30

    F. first, delete rows from the EMPLOYEES table for department id 30 and then delete the rows from the DEPARTMENTS table for dep

    Answer: BF
    B是级联删除,F是删除指定关联数据


    DELETE CASCADE Trigger for Parent Table

    The trigger in Example 9-14 enforces the DELETE CASCADE referential action on the primary key of the dept table.

    CREATE OR REPLACE TRIGGER dept_del_cascade
      AFTER DELETE ON dept
      FOR EACH ROW
    
      -- Before row is deleted from dept,
      -- delete all rows from emp table whose DEPTNO is same as
      -- DEPTNO being deleted from dept table:
    
    BEGIN
      DELETE FROM emp
      WHERE emp.Deptno = :OLD.Deptno;
    END;
    /



  • 相关阅读:
    Centos7配置局域网yum源报错——Error downloading packages: failed to retrieve packages...
    Centos7扩展根分区——不增加磁盘
    Paxos算法
    记一次业务中的大坑-MYSQL有重复数据下的增加主键
    填坑之路——Hadoop分布式缓存
    Java接口技术
    Java-IO操作性能对比
    Clob对象转换为String
    剖析Reflection.getCallerClass
    Java类的加载、链接和初始化
  • 原文地址:https://www.cnblogs.com/Babylon/p/8601913.html
Copyright © 2011-2022 走看看