1Z0-052 · Question #241
View the Exhibit to see the data in the emp table. You created a PRIMARY KEY constraint on the empno column of the emp table, and the constraint is not deferred. Which two statements are true in…
The correct answer is B. A unique index on the empno column would be created. D. A NOT NULL constraint would be enforced on the empno column. Creating a PRIMARY KEY constraint on a column automatically enforces both uniqueness via a unique index and NOT NULL on that column.
Question
View the Exhibit to see the data in the emp table. You created a PRIMARY KEY constraint on the empno column of the emp table, and the constraint is not deferred. Which two statements are true in this scenario? (Choose two.)
Exhibit
Options
- ANo index would be created or used in this case.
- BA unique index on the empno column would be created.
- CA CHECK constraint would be enforced on the empno column.
- DA NOT NULL constraint would be enforced on the empno column.
- EA bitmap unique index would be created on the empno column.
How the community answered
(47 responses)- A2% (1)
- B87% (41)
- C4% (2)
- E6% (3)
Why each option
Creating a PRIMARY KEY constraint on a column automatically enforces both uniqueness via a unique index and NOT NULL on that column.
This is incorrect because Oracle always creates a unique index to support the enforcement of a PRIMARY KEY constraint.
Oracle automatically creates a unique B-tree index on the PRIMARY KEY column to enforce uniqueness efficiently; this index is created implicitly when the constraint is added.
A CHECK constraint is a separate, distinct constraint type used to enforce a condition on column values; PRIMARY KEY does not imply or create a CHECK constraint.
A PRIMARY KEY constraint implicitly enforces NOT NULL on the constrained column because a primary key value must uniquely identify each row and cannot be null.
Oracle creates a standard B-tree unique index for PRIMARY KEY constraints, not a bitmap unique index; bitmap indexes are used in data warehouse environments for low-cardinality columns.
Concept tested: Oracle PRIMARY KEY constraint behavior and implicit index creation
Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/constraint_clauses.html
Topics
Community Discussion
No community discussion yet for this question.
