Drop Table cannot be used to drop a Table referenced by _______ constraint.…

2015

Drop Table cannot be used to drop a Table referenced by _______ constraint.

(a) Primary key    (b) Sub key    (c) Super key    (d) Foreign key

  1. A.

    (a)

  2. B.

    (a), (b) and (c)

  3. C.

    (d)

  4. D.

    (a) and (d)

Attempted by 1305 students.

Show answer & explanation

Correct answer: C

Answer: Foreign key constraint.

Reason: You cannot drop a table that is referenced by a foreign key in another table because doing so would break referential integrity. The foreign key in the referencing (child) table depends on the existence of the referenced (parent) table.

  • Common ways to drop the referenced table safely:

  • Remove the foreign key constraint from the referencing table (for example, using ALTER TABLE to drop the constraint), then drop the parent table.

  • Drop the referencing (child) table first, then drop the referenced (parent) table.

  • Use a DBMS-specific cascade option where supported (for example, DROP TABLE ... CASCADE in systems that support it) to remove dependent objects automatically. Use this with caution because it removes all dependent objects.

Example actions (DBMS syntax varies): ALTER TABLE child_table DROP CONSTRAINT fk_name; or DROP TABLE parent_table CASCADE; or DROP TABLE child_table; DROP TABLE parent_table.

Explore the full course: Mppsc Assistant Professor