In standard SQL, which statement is used to remove (drop) an existing table definition and its data from the database?

Difficulty: Easy

Correct Answer: DROP TABLE

Explanation:


Introduction / Context:
At times, DBAs must permanently remove a table—its definition and stored rows—from a schema. This is done with a DDL command, not a DML command. Knowing the correct verb prevents accidental misuse that could harm data integrity.



Given Data / Assumptions:

  • An existing table must be removed completely.
  • We are not deleting selected rows; we are removing the object.
  • Standard SQL semantics apply.


Concept / Approach:
DELETE removes row data but leaves the table structure. DROP TABLE removes both the data and the table definition (metadata). Therefore, to remove the table object itself, use DROP TABLE table_name.



Step-by-Step Solution:

Distinguish DML (row-level) vs DDL (object-level) operations.Identify the DDL verb for object removal: DROP.Apply to a table: DROP TABLE table_name;


Verification / Alternative check:
After DROP TABLE, the data dictionary shows the table no longer exists; dependent objects (constraints, indexes) may also be removed depending on vendor rules.



Why Other Options Are Wrong:

  • DELETE TABLE: DELETE targets rows, and syntax is DELETE FROM table.
  • ERASE/UNATTACH TABLE: not standard SQL statements.
  • None of the above: incorrect because DROP TABLE is correct.


Common Pitfalls:
Using DELETE when the intent is to remove the structure; or dropping without verifying dependencies/backups.



Final Answer:
DROP TABLE

More Questions from Database Systems

Discussion & Comments

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