Home >Database >Mysql Tutorial >MySQL DESCRIBE command?
MySQL's DESCRIBE or DESC are equivalent. DESC is the abbreviation of the DESCRIBE command and is used to display table information such as column names and column name constraints.
DESCRIBE command is equivalent to the following command -
SHOW columns from yourTableName command.
The following is a query to display information about a table with the help of DESCRIBE command. The query is as follows.
mysql> DESCRIBE Student;
Above, Student is the table name in my database.
The above query generates the following output.
+-------+--------------+------+-----+---------+-------+ | 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)
This is the equivalent query that gives the same results. The query is as follows.
mysql> show columns from student;
The following is the output.
+-------+--------------+------+-----+---------+-------+ | 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)
As you can see above, they both give the same output.
The above is the detailed content of MySQL DESCRIBE command?. For more information, please follow other related articles on the PHP Chinese website!