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 in the mysql table

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

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to check the notes in the mysql table, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The way to view the comments in the mysql table: 1, to view the comments of all tables through the "information_schema.TABLES" statement; 2, to view the comments of all tables through "information_schema.TABLES a LEFT JOIN..." Statement to query comments for all tables and fields, and so on.

Mysql view table comments or field comments

View comments for all tables

SELECTtable_name table name, table_comment table description FROMinformation_schema.TABLESWHEREtable_schema = 'database name' ORDER BYtable_name

Query comments for all tables and fields

SELECTa.table_name table name, a.table_comment table description, b.COLUMN_NAME field name, b.column_comment field description, b.column_type field type, b.column_key constraint FROMinformation_schema. TABLES aLEFT JOIN information_schema. COLUMNS b ON a.table_name = b.TABLE_NAMEWHEREa.table_schema = 'database name' ORDER BYa.table_name

Query comments for all fields of a table

Select COLUMN_NAME field name, column_comment field description, column_type field type, column_key constraint from information_schema.columns where table_schema = 'database name' and table_name = 'table name'

Or

Show full columns from table name

View the DDL generated by the table

Note that table names are not enclosed in single quotation marks

Show create table table name

Create new tables and add comments for tables and fields

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

Modify the comments of the table / field

Modify table comments

Alter table t_user comment = 'modified table annotation information (user information table)'

Modify field comment

Alter table t_user modify column id int comment 'primary key ID'; above is all the contents of how to view the comments in the mysql table. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Database

Wechat

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

12
Report