Get the App
SLTechnology News&Howtos  ›  Database  › 

How to view comments for tables by mysql

Shulou Source: shulou.com Published: 2022-05-31 12:16:51 09月24日 Update

This article will explain in detail the notes on how to view the table in mysql. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Methods: 1, use "show create table table name;" statement to view table comments; 2, use "select*from TABLES where TABLE_SCHEMA=' database name 'and TABLE_NAME=' table name" statement to view table comments.

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

The method of viewing table comments

-- look at the DDL generated by viewing the table in the generated SQL statement Note: table names are not enclosed in single quotes

Show create table table name

-look inside the metadata table

Use information_schema;select * from TABLES where TABLE_SCHEMA=' database name 'and TABLE_NAME=' table name'

Expand:

Write comments when you create a table

Create table t_user (ID INT (19) primary key auto_increment comment 'primary key', NAME VARCHAR (300) comment 'field comment', CREATE_TIME date comment 'creation time') comment = 'table comment'

Modify the comments of the table

Alter table table name comment 'comments for modified table'

Modify the comments of the field

Alter table table name modify column field name field type comment 'modified field comments'

-- Note: just write the field name and field type, and specify the length here if there is a specified length before.

Such as: alter table t_cal_res_channel MODIFY column resume_channel varchar (30) COMMENT 'Channel'

This is the end of this article on "comments on how to view tables in mysql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Comments fields data articles statements databases methods more types generation good Chinese practical content quotation marks tutorials articles time time channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info Redmi Docker Xiaomi