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 ; #你要查的表
原文地址:https://www.cnblogs.com/niuniu0108/p/9946583.html
时间: 2024-10-04 00:08:17