Home > Database > Mysql Tutorial > How to modify comments in mysql

How to modify comments in mysql

WBOY
Release: 2022-01-05 09:57:57
Original
3943 people have browsed it

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

How to modify comments in mysql

Check it

How to modify comments in mysql

2 Comments on modifying the table

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

How to modify comments in mysql

How to modify comments in mysql

3 Modify field comments

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

How to modify comments in mysql

How to modify comments in mysql

4 View table comments Method

--Look at

show create table 表名;
Copy after login

in the generated SQL statement--Look at

use information_schema;
select * from TABLES where TABLE_SCHEMA='数据库名' and TABLE_NAME='表名' ;
Copy after login

5 in the metadata table View field comments Method
--show

show full columns from 表名;
Copy after login

--Look in the metadata table

select * from COLUMNS where TABLE_SCHEMA='数据库名' and TABLE_NAME='表名' \;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template