How to view comments in mysql

青灯夜游
Release: 2021-12-07 11:09:52
Original
7277 people have browsed it

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.

How to view comments in mysql

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='学生表';
Copy after login

How to view comments in mysql

View the comments of the table

The code is as follows:

SHOW CREATE TABLE `student`;
Copy after login

How to view comments in mysql

Modify the comments of the table

The code is as follows:

ALTER TABLE `student` COMMENT '学生表2.0';
Copy after login

Result As shown in the picture:

How to view comments in mysql

How to view comments in mysql

Modify the comment of the field

The code is as follows:

ALTER TABLE `student` MODIFY COLUMN `id` COMMENT '学号';
Copy after login

How to view comments in mysql

View the comments of the field

The code is as follows:

SHOW FULL COLUMNS FROM `student`;
Copy after login

The result is as shown in the figure:

How to view comments in mysql

[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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!