Integrity management in SQL: Which command is used to enable, disable, or drop an integrity constraint defined on an existing table?

Difficulty: Easy

Correct Answer: ALTER TABLE

Explanation:


Introduction / Context:
Integrity constraints (PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK) enforce data correctness and relationships. After deployment, administrators may need to enable, disable, or drop a constraint temporarily (for bulk loads) or permanently (during schema changes). Selecting the correct command is essential for precise control with minimal disruption.


Given Data / Assumptions:

  • We are operating on an existing table.
  • The task involves constraint state or definition (enable/disable/drop).
  • Standard SQL semantics are assumed; vendor specifics may add options.


Concept / Approach:
The correct command for managing constraints on an existing table is ALTER TABLE. It supports adding, modifying, enabling/disabling (vendor-specific), and dropping constraints. Non-standard verbs like “DEFINE TABLE” or “MODIFY TABLE” are not part of portable SQL syntax and should be avoided unless referencing a specific vendor feature.


Step-by-Step Solution:

Recognize that constraint changes affect an existing object.Map to DDL operation: ALTER TABLE ... ADD/ENABLE/DISABLE/DROP CONSTRAINT.Select ALTER TABLE as the general, standard approach.


Verification / Alternative check:
Vendor manuals document ALTER TABLE as the entry point for constraint lifecycle management; some vendors support ENABLE/DISABLE keywords or require drop/recreate sequences.


Why Other Options Are Wrong:

  • DEFINE TABLE and MODIFY TABLE: not standard SQL commands.
  • All of the above: incorrect because only ALTER TABLE is standard and broadly correct.


Common Pitfalls:
Disabling constraints without revalidating data later; dropping constraints and forgetting to recreate them with the same semantics.


Final Answer:
ALTER TABLE

More Questions from Database Systems

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion