Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view comments for tables by mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report