How to Add MySQL Comments to Tables
In MySQL, you can use the ALTER TABLE statement to add comments to table columns.
For example, if we have a table named users with a field named name, and we want to add a comment “user name” to the name field. This can be achieved by using the following ALTER TABLE statement:
ALTER TABLE users MODIFY COLUMN name VARCHAR(50) COMMENT '用户姓名';
This statement changes the existing name field to be of VARCHAR(50) type and adds the comment “user name”.
Additionally, if you want to view the comments for the table fields, you can use the following DESCRIBE statement:
DESCRIBE users;
This will return information about the fields of the table “users”, including field names, types, and comments.