Home  >  Article  >  Database  >  How to modify comments in mysql

How to modify comments in mysql

WBOY
WBOYOriginal
2022-01-05 09:57:573891browse

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.

How to modify comments in mysql

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='表的注释';

How to modify comments in mysql

Check it

How to modify comments in mysql

2 Comments on modifying the table

alter table 表名 comment '修改后的表的注释';

How to modify comments in mysql

How to modify comments in mysql

3 Modify field comments

alter table 表名 modify   字段名 column  comment  类型'修改后的字段注释';

How to modify comments in mysql

How to modify comments in mysql

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn