describe 命令相当于以下命令 -
show columns from yourtablename command.
以下是借助 describe 命令显示有关表的信息的查询。查询如下。
mysql> describe student;
上面,student 是我数据库中的表名。
上述查询生成以下输出。
+-------+--------------+------+-----+---------+-------+| field | type | null | key | default | extra |+-------+--------------+------+-----+---------+-------+| id | int(11) | yes | mul | null | || name | varchar(100) | yes | mul | null | |+-------+--------------+------+-----+---------+-------+2 rows in set (0.13 sec)
这是给出相同结果的等效查询。查询如下。
mysql> show columns from student;
以下是输出。
+-------+--------------+------+-----+---------+-------+| field | type | null | key | default | extra |+-------+--------------+------+-----+---------+-------+| id | int(11) | yes | mul | null | || name | varchar(100) | yes | mul | null | |+-------+--------------+------+-----+---------+-------+2 rows in set (0.03 sec)
正如您在上面看到的,它们都给出相同的输出。
以上就是mysql 的 describe 命令?的详细内容。
