Reputation: 1040
Please suggest how to add comments to all columns of an existing table in database?
for eg: i have a table Employee with columns emp_id, emp_name, emp_salary, emp_address.
Now, i want to add comments to each column of the table.
Please suggest how to achieve it in one command.
Saw a duplicate thread: Alter MySQL table to add comments on columns
But the suggested reply could not be understood!
Upvotes: 0
Views: 6363
Reputation: 2988
Query:
ALTER TABLE Employee
MODIFY fieldname new_fieldname INT(11) COMMENT 'the comment you want to add',
MODIFY fieldname2 new_fieldname2 INT(11) COMMENT 'comment for the seconds row',
MODIFY fieldname3 new_fieldname3 INT(11) COMMENT 'comment for third row';
Note that you have to include the column definition again when adding the comment.
Upvotes: 3