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

The method of adding Field Notes to mysql Table

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article is about how to add field comments to the mysql table. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How to add field comments to the mysql table: add the field directly when the table is created, with the code [CREATE TABLE userinfo (id INT COMMENT 'number', uname VARCHAR (40) COMMENT 'user name',].

How to add field comments to the mysql table:

Direct po codes and cases

# write comments CREATE TABLE userinfo (id INT COMMENT 'number', uname VARCHAR (40) COMMENT 'user name', address VARCHAR (120) COMMENT 'home address', hobby VARCHAR (200) COMMENT 'hobby') COMMENT = 'user information table' when creating the table; # modify the annotation of the table ALTER TABLE userinfo COMMENT 'user information table'; # modify the field comments, note: just write the field name and field type ALTER TABLE userinfo MODIFY COLUMN uname VARCHAR (40) COMMENT 'name' # how to view table comments, look at SHOW CREATE TABLE userinfo;# in the generated SQL statement. Look at USE information_schema;SELECT * FROM TABLES WHERE TABLE_SCHEMA='shoppingcart' AND TABLE_NAME='userinfo'; # how to view field comments in the metadata table. SHOW FULL COLUMNS FROM userinfo;# looks at SELECT * FROM COLUMNS WHERE TABLE_SCHEMA='shoppingcart' AND TABLE_NAME='userinfo' in the metadata table.

Thank you for reading! On the mysql table to add field comments on the method to share here, 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, you can share it and let more people see it.

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