Home  >  Article  >  Database  >  How to view field comments in mysql

How to view field comments in mysql

王林
王林Original
2020-09-01 15:24:144618browse

Mysql method to view field comments: execute the [show full columns from test] command to view. If we want to view the comments of the data table, we can execute the [show create table test] command.

How to view field comments in mysql

The specific method is as follows:

(Learning video recommendation: mysql video tutorial)

Create Write comments when writing a table

create table test1
(
field_name int comment '字段的注释'
)comment='表的注释';

Modify the comments of the table

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

Modify the comments of the fields

alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行

(Related tutorial recommendations: mysql tutorial)

How to view table comments

--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G

How to view field comments

--show
show full columns from test1;
--在元数据的表里面看
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G

The above is the detailed content of How to view field 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