将表定义转为markdown格式的语句


将表定义 一个转为markdown格式的语句

SELECT CONCAT("## ",table_name," ",table_comment) as tabel_details 
FROM information_schema.TABLES
WHERE TABLE_schema='A'
and table_name ='B'

UNION ALL 

SELECT "|字段 | 类型 | 描述|" as tabel_details 

UNION ALL 
 
SELECT "|---- |---- |----|"  as tabel_details

UNION ALL 

SELECT concat("|",COLUMN_NAME,"|",COLUMN_TYPE,"|",COLUMN_COMMENT,"||") 
from information_schema.COLUMNS
WHERE TABLE_schema='A'
    and table_name ='B'
;

文章作者: 洛神葵
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 洛神葵 !
评论
  目录