Which of the following is the correct syntax to modify the datatype of a given attribute in an existing table?
Which of the following is the correct syntax to modify the datatype of a given attribute in an existing table?
Solution
✅ Correct Option: 4
The correct syntax is
ALTER TABLE changes the structure of an existing table. The MODIFY clause then changes the datatype (or size) of an existing column, for example ALTER TABLE student MODIFY name VARCHAR(50);
Option 1: the keyword TABLE is missing, so the statement is invalid.
Option 2: ADD inserts a new column into the table. It does not change an existing column.
Option 3: EDIT is not a valid SQL clause.
In MySQL, the same task can also be written with CHANGE, which additionally renames the column.
Related questions:
2026: 21 May Shift 1
2025: 13 May Shift 2
2026: 11 May Shift 2