首页 > 代码库 > 显示当前表的字段

显示当前表的字段

show columns from login;   //显示当前表的字段
mysql> use MySQL_DATA    //首先选择数据库
Database changed
mysql> show columns from test;     //选择表
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| name  | varchar(20) | YES  |     | NULL    |       |
| age   | int(11)     | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.02 sec)

mysql>

 

显示当前表的字段