mysql 查看表注解

 

 

SELECT
    t.TABLE_NAME AS '表名',
    t.COLUMN_NAME AS '字段名称',
  t.COLUMN_TYPE AS '数据类型',
  CASE IFNULL(t.COLUMN_DEFAULT,'Null') 
        WHEN '' THEN '空字符串' 
        WHEN 'Null' THEN 'NULL' 
        ELSE t.COLUMN_DEFAULT END  AS '默认值',
    CASE t.IS_NULLABLE WHEN 'YES' THEN '' ELSE '' END AS '是否可空',   
    t.COLUMN_COMMENT AS '字段说明'
FROM information_schema.COLUMNS t 
WHERE t.TABLE_SCHEMA='test_ds_bcp'  
  AND t.TABLE_NAME='web_coa_voucher_result' 
 and t.COLUMN_name like '%social%';

select table_name 表名,TABLE_COMMENT 表注释 
from INFORMATION_SCHEMA.TABLES Where table_schema = 'test_ds_bcp' AND table_name ="web_coa_voucher_result"

 

posted @ 2021-11-06 13:26  xiluhua  阅读(114)  评论(0编辑  收藏  举报