In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces mysql how to add notes, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Mysql add comments method: 1, use "alter table table name modify field name type constraint comment 'comment content';" statement to add comments to the field; 2, use "alter table table name comment 'comment content';" statement to add comments to the table.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
* * in the mysql database, comments for database tables and fields are added with the attribute comment. *
1. Add comments to the field:
1) when you create a new table, add comments after the field constraints of the table.
For example:
Create table users (id int (11) primary key comment 'user id')
Here users is the table name, id is the field name, int (11) is the type, and primary key is the constraint.
2) if it is a table that has been built, you can use the command to modify the field and add the comment attribute.
For example:
Alter table users modify name varchar (20) not null comment 'username'
Here users is the table name, name is the field name, varchar (20) is the type, and not null is the constraint.
two。 Add comments to the table:
1) when creating a new table, write a comment on the table outside the parentheses.
For example:
Create table users (id int (11) primary key comment 'user id') comment=' user Information Table'
2) if the table has been built, you can add comments when you modify the table.
For example:
Alter table users comment 'user Information Table'
The users here is the table name.
3. The method of viewing table comments
Show create table users
Here users is the table name.
4. How to view field comments
Show full columns from users
Here users is the table name.
Thank you for reading this article carefully. I hope the article "how to add comments on mysql" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.