MySQL中如何查询一张表的子段名、子段类型 、主键

select column_name,column_comment,column_data_type
from information_schema.columns
wehre table_name='表名称' and table_schema='数据库名称'

---information_schema.columns数据库表信息

--查询主键
select column_name
from information_schema.'key_column_usage'
where table_name='表名称' and constraint_name='primary'

posted @ 2021-04-25 10:13  陌上锦鲤  阅读(365)  评论(0)    收藏  举报