select column_name, column_type,is_nullable,if(akey=1,'PRI',if(akey='Key','主键','')),column_comment from (
select '' table_name,table_name as table_name2,table_name column_name,'' column_type,'' is_nullable,'' akey,TABLE_COMMENT column_comment from information_schema.tables where table_schema = 'bjnp1108'
and table_name not like 'vi_%' and table_name not like 'tb_%' and TABLE_COMMENT != ''
union
select 'Field' table_name,table_name as table_name2,'列名' column_name,'类型' column_type,'可空' is_nullable,'Key' akey,'备注' column_comment from information_schema.tables where table_schema = 'bjnp1108'
and table_name not like 'vi_%' and table_name not like 'tb_%' and TABLE_COMMENT != ''
union
select table_name,table_name as table_name2,column_name, column_type, is_nullable, column_name='id' as akey, column_comment
from information_schema.columns where table_schema = 'bjnp1108'
and table_name not like 'vi_%' and table_name not like 'tb_%'
union
select table_name,table_name as table_name2,'' column_name,'' column_type,'' is_nullable,'' akey,'' from information_schema.tables where table_schema = 'bjnp1108'
and table_name not like 'vi_%' and table_name not like 'tb_%' and TABLE_COMMENT != ''
) t order by table_name2;
用datagrip执行, 然后复制粘贴或execute to file