CreatetableEmployee(IDINTNOTNULLPRIMARYKEYAUTO_INCREMENT,NameVarchar(20));QueryOK,0rowsaffected(0.20sec) Now with the help of "DESCRIBEEmployee" statement we can get the information about the Employee table information. mysql>DescribeEmployee;+---"/> CreatetableEmployee(IDINTNOTNULLPRIMARYKEYAUTO_INCREMENT,NameVarchar(20));QueryOK,0rowsaffected(0.20sec) Now with the help of "DESCRIBEEmployee" statement we can get the information about the Employee table information. mysql>DescribeEmployee;+---">

Home >Database >Mysql Tutorial >What information does the MySQL DESCRIBE statement display?

What information does the MySQL DESCRIBE statement display?

王林
王林forward
2023-08-26 09:01:201067browse

MySQL DESCRIBE 语句显示什么样的信息?

The DESCRIBE statement provides information about the structure of a MySQL table.

Example

Consider constructing the following table name "Employee" using Create Table statement as shown below-

mysql> Create table Employee(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name Varchar(20));
Query OK, 0 rows affected (0.20 sec)

Now with the help of "DESCRIBE Employee" statement , we can get information about the employee table.

mysql> Describe Employee;
+-------+-------------+------+-----+---------+------------------+
| Field | Type        | Null | Key | Default | Extra            |
+-------+-------------+------+-----+---------+------------------+
| ID    | int(11)     | NO   | PRI | NULL    | auto_increment   |
| Name  | varchar(20) | YES  |     | NULL    |                  |
+-------+-------------+------+-----+---------+------------------+
2 rows in set (0.11 sec)

The above description tells us the name of the column, its data type, whether it can have NULL values, what values ​​it can store by default, its key constraints, and any other extras about it Information, such as auto_increment.

The above is the detailed content of What information does the MySQL DESCRIBE statement display?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete