In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how mysql modifies field comments". In daily operation, I believe many people have doubts about how to modify field notes in mysql. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "how to modify field notes by mysql". Next, please follow the editor to study!
In mysql, you can use the "ALTER TABLE" statement and the "column" keyword to modify the field comment, the syntax "alter table table name modify column field name field type comment 'modified field comment;".
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.
The sample code is as follows:
Create table test (id int not null default 0 comment 'user id')
If you have already built the table, you can also use the command to modify the field, and then add the comment attribute definition, you can add comments.
The sample code is as follows:
Alter table test modify column id int not null default 0 comment 'test table id'
Check the comments for all the fields of the existing table?
You can view it with the command: show full columns from table. Examples are as follows:
Show full columns from test; writes comments on create table test1 (comments of field_name int comment 'field') comment=' table when creating a table; comments on modified table alter table table name comment 'comments on modified table; comments on modified fields alter table table name modify column field name field type comment' modified field comments' -- Note: the way to view table comments by copying field names and field types-- look at show create table test1; in the generated SQL statement-- look at use information_schema; select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1'\ G in the table of metadata-- 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. At this point, the study on "how mysql modifies field comments" is over. I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.