mysql 读取comment_Mysql 获取表的comment 字段
查看獲取表內字段注釋:
> show full columns from tablename;
或是
show full fields from tablename;
或是,在元數據的表里面看
Select COLUMN_NAME 列名, DATA_TYPE 字段類型, COLUMN_COMMENT 字段注釋
from INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companies'##表名
AND table_schema = 'testhuicard'##數據庫名
AND column_name LIKE 'c_name'##字段名
查看表注釋的方法:
> show ?create ?table ?tablename;
獲取整個數據庫的所有表信息(包含表名,表注釋,表類型等等):
> SELECT table_name, table_type, engine
-> FROM information_schema.tables
-> WHERE table_schema = 'db5' //table_schema是數據庫名
-> ORDER BY table_name DESC;
//該語句請求按逆向字母順序列出數據庫db5中的所有表,但僅顯示三種信息:表名,表類型,以及表引擎。
INFORMATION_SCHEMA是信息數據庫,其中保存著關于MySQL服務器所維護的所有其他數據庫的信息.
> SELECT TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES ?WHERE
TABLE_NAME = 'sh_goods' AND TABLE_SCHEMA = 'sh_shop';//獲取sh_shop 數據庫中
sh_goods 表 的注釋。
獲取表注釋或是
或者使用:show table status;
Comment 就是表注釋。
修改表的注釋:
alter table test1 comment '修改后的表的注釋';
修改字段的注釋:
alter table test1 modify column field_name int comment '修改后的字段注釋';
總結
以上是生活随笔為你收集整理的mysql 读取comment_Mysql 获取表的comment 字段的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第 36 章 RRDTool
- 下一篇: 真静态和伪静态的区别