查看获取表内字段注释: > 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 '修改后的字段注释';
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有