zoukankan      html  css  js  c++  java
  • OCP-1Z0-052-V8.02-10题

    10. Examine the following statement that is used to modify the constraint on the SALES table:

    SQL> ALTER TABLE SALES MODIFY CONSTRAINT pk DISABLE VALIDATE;

    Which three statements are true regarding the above command? (Choose three.)

    A.The constraint remains valid.

    B.The index on the constraint is dropped.

    C.It allows the loading of data into the table using SQL *Loader.

    D.New data conforms to the constraint, but existing data is not checked

    E.It allows the data manipulation on the table using INSERT/UPDATE/DELETE SQL statements.

    Answer: ABC

    答案解析:

    参考:http://blog.csdn.net/rlhua/article/details/12251961

    这道题,可用排除法来做,D:属于ENABLE NOVALIDATE,E,不能对已存在的数据做update

    所以,只能选择ABC

    简单来讲,DISABLE 和ENABLE 是针对新增的数据是否符合约束,NOVALIDATE 和VALIDATE是针对已经存在的数据是否符合约束。

    题中是DISABLE VALIDATE即是针对新增的数据可以不符合约束,但是已经存在的数据要满足约束。

    可以使用排除法,D是属于.ENABLENOVALIDATE

    E,不能修改已经存在数据,错误。

    C正确,是因为对新增的数据不限制,没有约束。

    A正确,是因为DISABLE VALIDATE对现有的数据还有约束。

    B呢?

    约束条件状态

    为了更好地处理数据可能暂时违反约束条件的情况,可将约束条件指定为不同的状态。可以启用(ENABLE) 或禁用(DISABLE) 完整性约束条件。
    如果启用约束条件,在数据库中输入或更新数据时就会检查数据。此时,禁止输入不符合约束条件规则的数据。
    如果禁用约束条件,则可以在数据库中输入不符合规则的数据。
    完整性约束条件可处于以下一种状态:
    • DISABLE NOVALIDATE
    • DISABLE VALIDATE
    • ENABLE NOVALIDATE
    • ENABLE VALIDATE
    DISABLE NOVALIDATE:不检查新数据和现有数据,因此这些数据可能不符合约束条件。
    当数据来自验证过的源,而且表是只读表时,通常会使用此状态。因此,不会将新数据输入表中。在已清理了数据的数据仓库环境中使用NOVALIDATE。此时不需要进行验证,因而可以节省很多时间。
    DISABLE VALIDATE:如果约束条件处于此状态,则不允许对有约束条件的列进行任何修改。因为如果在验证现有数据后,又允许将未经检查的数据输入表中,就会出现不一致的情况。通常,在必须验证现有数据但不进行修改时,以及不需要索引来提高性能时,可使用此状态。
    ENABLE NOVALIDATE:新数据符合约束条件,但现有数据处于未知状态。通常在确信表中只存在纯净数据和符合规则的数据的情况下使用该状态,此时不需要进行验证。但是,不允许将违反规则的新数据输入到系统中。
    ENABLE VALIDATE:新数据与现有数据均符合约束条件。这是约束条件的典型状态和默认状态。

    You can specify that a constraint is enabled (ENABLE) or disabled (DISABLE). If a constraint is enabled, data is checked as it is entered or updated in the database, and data that does not conform to the constraint is prevented from being entered. If a constraint is disabled, then data that does not conform can be allowed to enter the database.

    Additionally, you can specify that existing data in the table must conform to the constraint (VALIDATE). Conversely, if you specifyNOVALIDATE, you are not ensured that existing data conforms.

    An integrity constraint defined on a table can be in one of the following states:

    • ENABLE, VALIDATE

    • ENABLE, NOVALIDATE

    • DISABLE, VALIDATE

    • DISABLE, NOVALIDATE

  • 相关阅读:
    删库跑路技术白皮书
    linux shell文件截取前几行,后几行,中间几行命令
    python 带参数 单步执行 (调试 pdb)
    分区助手专业版 v6.2 如何把win10系统迁移到SSD固态硬盘
    GUPPY 3.1.5 安装
    Java调用其他语言
    python代码中获取python版本号的方法
    f-Strings:Python 3格式字符串的新方法(f字符串)
    Centos 安装 pigz
    #!/usr/bin/env python与#!/usr/bin/python的区别
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317125.html
Copyright © 2011-2022 走看看