Modifying Column Comments in MySQL
To add or modify comments on columns in MySQL, use the following syntax:
ALTER TABLE table_name CHANGE column_name column_name data_type COMMENT 'comment text';
For example:
ALTER TABLE user CHANGE id id INT(11) COMMENT 'id of user';
This command modifies the id column in the user table, adding the comment "id of user".
Note: The COMMENT clause can only be used when modifying the column definition, not when adding a new column. To add a comment to a new column, use the following syntax:
ALTER TABLE table_name ADD column_name data_type COMMENT 'comment text';
The above is the detailed content of How to Modify Column Comments in MySQL?. For more information, please follow other related articles on the PHP Chinese website!