Skip to main contentSkip to solution

Which of the following commands is used to modify structure of the table?

Solution

✅ Correct Option: 3

ALTER TABLE changes the structure of an existing table. It can add, drop or modify columns and change constraints, for example ALTER TABLE student ADD age INT;\texttt{ALTER TABLE student ADD age INT;}


Option 1: CREATE TABLE builds a new table, it does not change an existing one.

Option 2: DROP TABLE deletes the whole table (structure and data), rather than modifying it.

Option 4: MODIFY TABLE is not a valid SQL command. MODIFY is only a clause used inside ALTER TABLE, as in ALTER TABLE student MODIFY name VARCHAR(50);\texttt{ALTER TABLE student MODIFY name VARCHAR(50);}

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question