In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains how to add notes to the mysql table. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "mysql table how to add notes" bar!
In mysql, you can use the "create table" statement and the comment keyword to add comments when creating the table, and the syntax "create table table name (field name field type comment 'field comment') comment=' table comment';".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In the MySQL database, comments for tables or fields (columns) are added with the attribute comment.
In the script that creates the new table, you can add comments by adding the comment attribute to the field definition script.
MySQL table statement + add comments
1. Build tables + comments
Syntax:
Create table table name (field name field type comment 'field comments') comment=' comments'
Example
CREATE TABLE student (id INT PRIMARY KEY AUTO_INCREMENT COMMENT 'student number', name VARCHAR COMMENT 'name', age int COMMENT 'age') COMMENT=' student information'
two。 Modify comment
Modify Table Notes-ALTER TABLE student COMMENT 'Student Table'
Modify column comments-ALTER TABLE student MODIFY COLUMN name VARCHAR (100) COMMENT 'name'
SELECT table_name,table_comment FROM information_schema.tables WHERE table_schema = 'db' AND table_name =' table name groups'SHOW FULL COLUMNS FROM groups
This allows you to conditionally search for information about a column of a name or data type: for example
SHOW FULL COLUMNS FROM tableName WHERE FIELD = 'add_time' OR TYPE LIKE'% date%'-look at the column SELECT column_name in the tableName table whose name is add_time or the type is date, column_comment FROM information_schema.columns WHERE table_schema = 'db' AND table_name =' groups'SHOW CREATE TABLE communication_group so far, I believe you have a deeper understanding of "how to add comments to the mysql table", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.