mysql 获取表信息 表备注等

select table_name, table_comment, create_time, update_time from information_schema.tables
-- where table_schema = (select database())  -- 当前数据库

 

 

select column_name, (case when (is_nullable = 'no' && column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type ,column_key
from information_schema.columns where table_schema = (select database()) and table_name = "sys_notice"
order by ordinal_position

 

 

posted @ 2022-03-19 11:25  我没有出家  阅读(223)  评论(0编辑  收藏  举报