码迷,mamicode.com
首页 > 数据库 > 详细

mysql 表名和字段、备注

时间:2019-09-18 11:05:01      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:osi   and   max   column   db_name   view   font   nbsp   div   

 

 

select
     t1.table_schema
    ,t1.table_name
    ,t2.ordinal_position
    ,t2.column_name
    ,t2.data_type
    ,t2.character_maximum_length
    ,t2.column_type
    ,t2.column_comment
from information_schema.tables t1
left join information_schema.columns t2
    on t1.table_schema = t2.table_schema and t1.table_name = t2.table_name
where t1.table_schema = db_name
    and t1.table_type = view
    and t1.table_name = v_name
order by
     t1.table_schema
    ,t1.table_name
    ,t2.ordinal_position
limit 100
;

select
     column_name
    ,data_type
    ,CHARACTER_MAXIMUM_LENGTH
    ,column_type
    ,column_comment
from information_schema.columns
where TABLE_SCHEMA =db_name
    and TABLE_NAME = v_name
order by ORDINAL_POSITION
;

 

mysql 表名和字段、备注

标签:osi   and   max   column   db_name   view   font   nbsp   div   

原文地址:https://www.cnblogs.com/chenzechao/p/11539839.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!