SQL DDL basics: Which SQL command allows you to redefine the structure of an existing table (for example, change a column's data type, add a column, or modify constraints)?

Difficulty: Easy

Correct Answer: ALTER TABLE

Explanation:


Introduction / Context:
Database schemas evolve. Administrators and developers often need to add columns, change data types, rename objects, or adjust constraints. Knowing the correct DDL command for in-place schema evolution is essential for safe, controlled changes in production environments.


Given Data / Assumptions:

  • Standard SQL naming conventions are assumed.
  • We are modifying an existing table, not creating a new one.
  • Operations can include add/modify/drop column and constraint alterations.


Concept / Approach:
The ALTER TABLE statement is the canonical DDL command for changing a table’s definition. Variants such as DEFINE TABLE or MODIFY TABLE are not standard SQL commands (though some DBMSs may offer vendor-specific syntax). For portability and correctness, ALTER TABLE is the correct choice.


Step-by-Step Solution:

Identify that schema change on an existing table is required.Recall that ALTER TABLE supports add/alter/drop column and constraint operations.Select ALTER TABLE as the standard SQL command.


Verification / Alternative check:
DBMS documentation (SQL standard and vendor manuals) shows ALTER TABLE as the mechanism for structural changes post-creation.


Why Other Options Are Wrong:

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


Common Pitfalls:
Assuming vendor dialect keywords are portable; always verify against SQL standard or your specific DBMS.


Final Answer:
ALTER TABLE

Discussion & Comments

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