mySql获取表结构语句

获取完整表结构:

其中,where语句table_name字段的值替换为你的表名,table_schema字段的值替换为你的数据库名。

select * from information_schema.`COLUMNS` where table_name='records' and table_schema='zc_archives'

 

获取表结构关键信息:

select ordinal_position 序号,column_name 字段名,is_nullable 可空,data_type 数据类型,column_type 长度,column_key 主外键,column_comment 字段说明 from information_schema.`COLUMNS` where table_name='arc_anjuan_records' and table_schema='zc_archives'

 

posted @ 2023-04-21 16:49  龙行天涯  阅读(114)  评论(0编辑  收藏  举报