nerdexam
Oracle

1Z0-060 · Question #158

Which two statements are true regarding constraints?

The correct answer is B. A column with the unique constraint can contain null values. D. A constraint can be disabled even if the constraint column contains data. This question tests knowledge of Oracle SQL constraint behavior, specifically NULL handling with UNIQUE constraints and the ability to disable constraints on columns that already contain data.

Upgrading to Oracle Database 12c

Question

Which two statements are true regarding constraints?

Options

  • AA foreign key cannot contain null values.
  • BA column with the unique constraint can contain null values.
  • CA constraint is enforced only for the insert operation on a table.
  • DA constraint can be disabled even if the constraint column contains data.
  • EAll constraints can be defined at the column level as well as the table level.

How the community answered

(39 responses)
  • A
    5% (2)
  • B
    90% (35)
  • C
    3% (1)
  • E
    3% (1)

Why each option

This question tests knowledge of Oracle SQL constraint behavior, specifically NULL handling with UNIQUE constraints and the ability to disable constraints on columns that already contain data.

AA foreign key cannot contain null values.

Foreign key columns can contain NULL values, which simply indicate the absence of a relationship to the parent table - only non-null foreign key values must match an existing primary key in the referenced table.

BA column with the unique constraint can contain null values.Correct

The UNIQUE constraint prevents duplicate non-null values but permits multiple NULL values because NULL is not considered equal to any value, including another NULL, under standard SQL semantics. Oracle enforces this behavior consistently, so a UNIQUE column may have many rows with NULL without violating the constraint.

CA constraint is enforced only for the insert operation on a table.

Constraints are enforced for all DML operations - INSERT, UPDATE, and DELETE - not only for INSERT, since an UPDATE could introduce a duplicate or a DELETE could orphan child rows.

DA constraint can be disabled even if the constraint column contains data.Correct

Oracle's ALTER TABLE ... DISABLE CONSTRAINT command suspends constraint enforcement without requiring the column data to be removed or modified, allowing constraints to be disabled regardless of existing data.

EAll constraints can be defined at the column level as well as the table level.

The NOT NULL constraint can only be defined at the column level and cannot be specified as a table-level constraint, so not all constraint types support both definition styles.

Concept tested: Oracle SQL constraint behavior and NULL semantics

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/constraint.html

Topics

#constraints#unique constraint#NULL values#constraint management

Community Discussion

No community discussion yet for this question.

Full 1Z0-060 Practice