select t.TABLE_NAME AS 表名,
t.TABLE_COMMENT AS 表备注,
c.COLUMN_NAME as 字段,
c.COLUMN_COMMENT as 字段备注,
c.DATA_TYPE as 字段类型,
IF(c.COLUMN_KEY='PRI','是','否') as 是否主键,
IF(c.IS_NULLABLE='YES','是','否') as 是否可空
from
information_schema.COLUMNS c
INNER JOIN information_schema.TABLES t ON c.table_schema = t.table_schema AND t.table_name = c.table_name
where c.table_name = '表名' and c.table_schema = '数据库'
mysql查看指定表字段
最新推荐文章于 2024-07-05 17:52:41 发布