Welcome

首页 / 数据库 / MySQL / MySQL获取表字段信息

1、desc tablename;

2、show full FIELDS from tablename;

3、show columns from tablename;

4、use information_schema;select * from columns where table_name ='tablename';

5、select * from information_schema.`COLUMNS` where TABLE_NAME='ws_admin';

以上方式中(4,5是同一种,建议使用后者)


2,4两种取得的数据字段结构比较完整,包含了字段注释信息。建议使用。