zoukankan      html  css  js  c++  java
  • 052-168

    You execute this command to drop the ITEM table, which has the primary key referred in the ORDER
    table:
    SQL> DROP TABLE scott.item CASCADE CONSTRAINTS PURGE;
    Which two statements are true about the effect of the command? (Choose two.)
    A.No flashback is possible to bring back the ITEM table.
    B.The ORDER table is dropped along with the ITEM table.
    C.The dependent referential integrity constraints in the ORDER table are disabled.
    D.The dependent referential integrity constraints in the ORDER table are removed.
    E.The table definition of the ITEM table and associated indexes are placed in the recycle bin.

    由于使用了 PURGE,不会将表和相关的对象放入回收站,因此 flashback 不能用,A 对,E 错
    指定 CASCADE CONSTRAINTS 语句是指删除所有的参照完整性约束包括主键约束和唯一性约束。
    如果不指定此语句,则参照完整性约束还存在,drop table 时会返回一个错误。 C 错,D 对
    B 错误,如果想实现这个需要级联删除,
    alter table order_status2 add constraint order_status2_modified_by_fk modified_by references
    employees(employee_id) on delete cascade;
    --使用了 on delete cascade 语句,用于删除父表一条记录的时候,子表记录也要删除
    alter table order_status2 add constraint order_status2_modified_by_fk modified_by references
    employees(employee_id) on delete set null;
    --这里使用了 on delete set null 语句,当父表删除的时候,子表记录就会设置为空

  • 相关阅读:
    Linux文档中翻页和搜索关键字
    windows安装mysql
    生成二维码和解析二维码
    powerdesigner通过er图生成mysql执行文件
    powerdesigner使用遇到的一些问题
    UnsupportedOperationException异常
    String[]和List的区别及相互转换
    @PostConstruct注解原理解析
    git强制更新并覆盖本地修改
    Dubbo架构与底层实现
  • 原文地址:https://www.cnblogs.com/Babylon/p/8039202.html
Copyright © 2011-2022 走看看