Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql view comments

Shulou Source: shulou.com Published: 2022-05-31 12:40:15 11月12日 Update

This article mainly explains "mysql how to view comments", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "mysql how to view comments" bar!

Mysql 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.

To give you a demonstration, here to create a random student table, the code is as follows:

CREATE TABLE `student` (`id` int (11) AUTO_INCREMENT PRIMARY KEY COMMENT 'learn well', `name` varchar (32) NOT NULL DEFAULT''COMMENT' name', `sex`tinyint (1) NOT NULL COMMENT 'gender', `age`tinyint (4) NOT NULL COMMENT 'age', `class`varchar (32) NOT NULL DEFAULT''COMMENT' class') ENGINE=InnODB CHARSET=utf8 COMMENT=' student form'

View comments for 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 'Student form 2.0'

The result is shown in the figure:

Modify the comments of the field

The code is as follows:

ALTER TABLE `student`MODIFY COLUMN `id`COMMENT 'student ID'

View comments for a field

The code is as follows:

SHOW FULL COLUMNS FROM `student`

The result is shown in the figure:

Thank you for your reading, the above is the content of "mysql how to view comments", after the study of this article, I believe you have a deeper understanding of how to view comments on mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Comments codes fields students learning content results statements such as picture name student number that is age ideas gender situation tutorials articles methods more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Shulou Tech Info Xiaomi Redmi