MySQL built table statement + MySQL built table statement to add comments + Add a comment

Notes 1. The construction of the table +

TABLE Student the CREATE ( 
  the above mentioned id INT PRIMARY KEY AUTO_INCREMENT the COMMENT 'student number', 
  name VARCHAR (200) the COMMENT 'name', 
  Age int the COMMENT 'Age' 
) the COMMENT = 'student information'

2. Modify the comment

Copy the code
Review Notes to Table -ALTER TABLE student COMMENT 'Student table'; 
                    
Modify columns Note -ALTER TABLE student MODIFY COLUMN name VARCHAR ( 100) COMMENT ' name'; 

the SELECT table_name, the WHERE table_comment the FROM information_schema.tables TABLE_SCHEMA = 'where db' AND table_name = 'table Groups' 
SHOW the FROM FULL Groups the cOLUMNS 
- information this condition may be to search for a name or a data type of a column: e.g. 
SHOW FULL cOLUMNS FROM tableName WHERE FIELD = ' add_time 'oR tYPE LIKE'% date% '- See table column names are tableName add_time date or type of column 
the SELECT column_name, the WHERE column_comment the FROM from information_schema.columns TABLE_SCHEMA =' DB 'the AND table_name =' Groups' 
SHOW the CREATE tABLE communication_group
Copy the code

3. Check Method:

 Method 1: show full fields from 'table name'; // to all information outputs

 Method 2: show create table gbox;

modified comment table entry (e.g., modified GBOX Table):

 ALTER Table GBOX the COMMENT = ' new information ';

modify a database table columns (name) of the COMMENT:

  ALTER Change table GBOX the cOLUMN name name DataType the COMMENT' new new column commen

 

 
 

Notes 1. The construction of the table +

TABLE Student the CREATE ( 
  the above mentioned id INT PRIMARY KEY AUTO_INCREMENT the COMMENT 'student number', 
  name VARCHAR (200) the COMMENT 'name', 
  Age int the COMMENT 'Age' 
) the COMMENT = 'student information'

2. Modify the comment

Copy the code
Review Notes to Table -ALTER TABLE student COMMENT 'Student table'; 
                    
Modify columns Note -ALTER TABLE student MODIFY COLUMN name VARCHAR ( 100) COMMENT ' name'; 

the SELECT table_name, the WHERE table_comment the FROM information_schema.tables TABLE_SCHEMA = 'where db' AND table_name = 'table Groups' 
SHOW the FROM FULL Groups the cOLUMNS 
- information this condition may be to search for a name or a data type of a column: e.g. 
SHOW FULL cOLUMNS FROM tableName WHERE FIELD = ' add_time 'oR tYPE LIKE'% date% '- See table column names are tableName add_time date or type of column 
the SELECT column_name, the WHERE column_comment the FROM from information_schema.columns TABLE_SCHEMA =' DB 'the AND table_name =' Groups' 
SHOW the CREATE tABLE communication_group
Copy the code

3. Check Method:

 Method 1: show full fields from 'table name'; // to all information outputs

 Method 2: show create table gbox;

modified comment table entry (e.g., modified GBOX Table):

 ALTER Table GBOX the COMMENT = ' new information ';

modify a database table columns (name) of the COMMENT:

  ALTER Change table GBOX the cOLUMN name name DataType the COMMENT' new new column commen

 

Guess you like

Origin www.cnblogs.com/jiangfeilong/p/11131099.html