Home >Database >Mysql Tutorial >How to view field comments in mysql

How to view field comments in mysql

王林
王林Original
2020-10-13 14:40:114718browse

mysql查看字段的备注的方法:直接执行【show full columns from table.A;】语句即可查看表及字段的备注。

How to view field comments in mysql

1、单次查看表及字段备注

(推荐教程:mysql视频教程

show full columns from table.A;

2、查看整个数据库内查看数据库内所有的表名、表备注、字段名称、字段类型、字段备注

select 	t.TABLE_NAME
			,t.TABLE_COMMENT
			,c.COLUMN_NAME
			,c.COLUMN_TYPE
			,c.COLUMN_COMMENT 
from 
information_schema.`COLUMNS` c 
,information_schema.`TABLES` t 
where 	 c.TABLE_NAME = t.TABLE_NAME
and		 t.TABLE_SCHEMA = 'database'  --更换为自己查询的数据库名称
;

相关推荐:mysql教程

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