Home >Database >Mysql Tutorial >How to view comments in mysql
Mysql method to view comments: 1. Use the "SHOW CREATE TABLE table name;" statement to view table comments; 2. Use the "SHOW FULL COLUMNS FROM table name;" statement to view field comments.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
Let me give you a demonstration. Create a student table here. The code is as follows:
CREATE TABLE `student` ( `id` int(11) AUTO_INCREMENT PRIMARY KEY COMMENT '学好', `name` varchar(32) NOT NULL DEFAULT '' COMMENT '姓名', `sex` tinyint(1) NOT NULL COMMENT '性别', `age` tinyint(4) NOT NULL COMMENT '年龄', `class` varchar(32) NOT NULL DEFAULT '' COMMENT '班级' )ENGINE=InnODB CHARSET=utf8 COMMENT='学生表';
View the comments of the table
The code is as follows:
SHOW CREATE TABLE `student`;
Modify the comments of the table
The code is as follows:
ALTER TABLE `student` COMMENT '学生表2.0';
Result As shown in the picture:
Modify the comment of the field
The code is as follows:
ALTER TABLE `student` MODIFY COLUMN `id` COMMENT '学号';
View the comments of the field
The code is as follows:
SHOW FULL COLUMNS FROM `student`;
The result is as shown in the figure:
[Related recommendations: mysql video tutorial]
The above is the detailed content of How to view comments in mysql. For more information, please follow other related articles on the PHP Chinese website!