1 Write comments when creating a table
CREATE TABLE Test1
(
field_name int comment ' field comment '
) comment= ' table notes ';
2 Modifying a table's annotations
ALTER TABLE TEST1 comment ' modified table comment ';
3 Modifying a comment for a field
ALTER TABLE test1 Modify column field_name int comment ' modified field comment ';
--Note: The Field name and field type are written as follows.
4 Ways to view table annotations
--in the generated SQL statement
Show CREATE table test1;
--in the table of meta-data
Use INFORMATION_SCHEMA;
SELECT * from TABLES where table_schema= ' my_db ' and table_name= ' test1 ' \g
5 ways to view field annotations
--show
Show full columns from test1;
--in the table of meta-data
SELECT * from COLUMNS where table_schema= ' my_db ' and table_name= ' test1 ' \g
MySQL Add table comments, field comments, view and modify comments