SQL Data Definition — Removing a Table Which command correctly eliminates (drops) the table named CUSTOMER from a relational database?

Difficulty: Easy

Correct Answer: DROP TABLE CUSTOMER;

Explanation:


Introduction:
SQL distinguishes between data definition language (DDL) statements that change schema and data manipulation language (DML) statements that change row data. Knowing the correct command to remove a table is a basic DBA skill and prevents accidental misuse of DML where DDL is required.


Given Data / Assumptions:

  • We want to eliminate the table object itself, not merely its rows.
  • Standard SQL syntax is assumed across common RDBMS products.
  • The table name is CUSTOMER.


Concept / Approach:
DROP TABLE is the DDL command that removes the table definition and, by default, its data, indexes, and constraints (subject to dependencies and DBMS rules). DELETE affects rows within an existing table; UPDATE modifies rows; REMOVE is not standard SQL. TRUNCATE TABLE removes data rows quickly but retains the table definition, so it is not equivalent to dropping the table.


Step-by-Step Solution:
1) Identify that schema removal requires DDL, not DML.2) Choose DROP TABLE for eliminating the table object.3) Exclude DELETE and UPDATE because they operate on data rows, not the schema object.4) Exclude TRUNCATE because it preserves the table definition.


Verification / Alternative check:
DBMS documentation for DROP TABLE confirms that the object is removed and dependent objects may need handling (such as foreign keys). Backups or migrations should precede destructive DDL.


Why Other Options Are Wrong:

  • REMOVE TABLE: Not defined in standard SQL.
  • DELETE TABLE: DELETE operates on rows via DELETE FROM.
  • UPDATE TABLE: Changes row values; does not remove the table.
  • TRUNCATE permanent: Nonstandard phrasing; TRUNCATE drops rows but keeps the table.


Common Pitfalls:
Confusing TRUNCATE with DROP; TRUNCATE is irreversible for data but preserves the table, whereas DROP removes the schema object itself.


Final Answer:
DROP TABLE CUSTOMER;

Discussion & Comments

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