Method: 1. Use the "alter table table name comment 'modified comment';" statement to modify the comment of the table; 2. Use the "alter table table name modify field name column comment type' modified comment The ';' statement modifies the comment of the field.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to modify comments in mysql
1 Write comments when creating a table and use the comment keyword
Syntax:
create table 表名 ( 字段名 类型 comment '字段的注释' )comment='表的注释';
Check it
2 Comments on modifying the table
alter table 表名 comment '修改后的表的注释';
3 Modify field comments
alter table 表名 modify 字段名 column comment 类型'修改后的字段注释';
4 View table comments Method
--Look at
show create table 表名;
in the generated SQL statement--Look at
use information_schema; select * from TABLES where TABLE_SCHEMA='数据库名' and TABLE_NAME='表名' ;
5 in the metadata table View field comments Method
--show
show full columns from 表名;
--Look in the metadata table
select * from COLUMNS where TABLE_SCHEMA='数据库名' and TABLE_NAME='表名' \;
Recommended learning: mysql video tutorial
The above is the detailed content of How to modify comments in mysql. For more information, please follow other related articles on the PHP Chinese website!