MySql查看数据库构建 和 表或字段的注释

/* 查询数据库 ‘bubble’构建 */

select table_name,table_type,engine,table_rows,TABLE_COLLATION,VERSION,concat(truncate(data_length/1024,2),'字节') as data_size,concat(truncate(index_length/1024,2),'字节') as index_length,data_free,TABLE_COMMENT FROM information_schema.tables WHERE table_schema = 'bubble' ORDER BY table_name DESC;

 

/* 查询数据库 ‘bubble’ 所有表注释 */

SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema='bubble';

 

/* 查询数据库 ‘bubble’ 下表 ‘account’ 所有字段注释 */

SELECT COLUMN_NAME,column_comment FROM INFORMATION_SCHEMA.Columns WHERE table_name='account' AND table_schema='bubble';

 

/* 一次性查询数据库 "bubble" 下表注释以及对应表字段注释 */

SELECT t.TABLE_NAME,t.TABLE_COMMENT,c.COLUMN_NAME,c.COLUMN_TYPE,c.COLUMN_COMMENT FROM information_schema.TABLES t,INFORMATION_SCHEMA.Columns c WHERE c.TABLE_NAME=t.TABLE_NAME AND t.`TABLE_SCHEMA`='bubble';

你可能感兴趣的:(MySQL)