select Column_name as 列名,is_nullable as 是否可为空,data_type as 数据类型,column_default as 默认值,case when column_key ='PRI' then '主键' when column_key ='UNI' then '唯一约束' when column_key ='MUL' then '可以重复' else '' end as 列键,column_comment as 字段说明 from information_schema.columns
where table_schema = 'datashar' #表所在数据库
and table_name = 'departmentinfo' order by column_key desc ; #你要查的表

 

 

 

select Column_name as 列名,
data_type as 数据类型,
case when column_key ='PRI' then '主键' when column_key ='UNI' then '唯一约束' when column_key ='MUL' then '可以重复' else '' end as 列键,
case when column_default is null then 'null' else column_default end as 默认值,
column_comment as 字段说明
from information_schema.columns
where table_schema = 'pt_portal' #表所在数据库
and table_name = 'account_apply' order by column_key desc ; #你要查的表

posted on 2018-11-12 15:09  田坤坤  阅读(497)  评论(0编辑  收藏  举报