Home > Database > Mysql Tutorial > body text

MySQL DESCRIBE command?

WBOY
Release: 2023-08-28 21:13:05
forward
1541 people have browsed it

MySQL 的 DESCRIBE 命令?

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.
Copy after login

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;
Copy after login

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)
Copy after login

This is the equivalent query that gives the same results. The query is as follows.

mysql> show columns from student;
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!