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 set field comments by mysql

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Editor to share with you how to set mysql field comments, I believe that 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!

Setting method: 1, use "create table table name (field name field type comment 'field comment');" statement; 2, use "alter table table name modify column field name field type comment 'field comment';" statement.

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

In the MySQL database, comments for fields or columns are added with the property comment.

In the script that creates the new table, you can add comments by adding the comment attribute to the field definition script.

Write field comments when creating a table

Create table test1 (comments for field_name int comment 'field')

Modify the comments of the field

Alter table test1 modify column field_name int comment 'modified field comments';-- Note: just write the field name and field type.

How to view field comments

-- show show full columns from test1;-- look at select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1'\ G in the metadata table. The above is all the content of the article "how to set field comments for mysql". 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