Mysql modify the table notes, information columns

1, add tables and fields Comment

At the same time to create the tables, fields, and add comments to the table

- Create a user information table 
the CREATE  TABLE tb_user 
( 
    ID the INT the AUTO_INCREMENT a PRIMARY  KEY the COMMENT ' number ' , 
    name VARCHAR ( 30 ) the COMMENT ' name ' 
) the COMMENT =  ' user information table ' ;

2, modify the table Notes

The ALTER  TABLE tb_user the COMMENT ' user information table 2 ' ;

3. Modify the comment field

ALTER TABLE tb_user MODIFY COLUMN name VARCHAR(30) NOT NULL COMMENT '姓名2';

Note: should write the complete definition of the field, such as field types, modifying attributes and so on. Do not because just to modify a comment, and the other attributes of this field is defined to cover out.

4, query field information

SHOW FULL COLUMNS FROM tb_user;

5, modify the column name

 The ALTER  TABLE m_facerecognitioninfo the CHANGE CardswipeResult CardSwipeResult VARCHAR ( 32 ) the COMMENT ' card results ' ;

 

Guess you like

Origin www.cnblogs.com/MagicAsa/p/11057863.html