The MySQL desc command is used to view the table structure, which is the shorthand form for the describe command.
MySQL desc command syntax:
DESC TableName
What information does the command display on the table? The specific include:
- Fields Name (field)
- field type (type)
- Whether the field is null
- Whether the field is a primary key (key)
- Default value for field
- Extra
Instance:
Mysql> CREATE TABLE Employee (-> ID INT (2) Auto_increment primary key,-> first_name (VARCHAR),-&G T Last_Name VARCHAR,-> start_date date,-> Salary int (6),-> City VARCHAR,->
On VARCHAR ()->);
Query OK, 0 rows affected (0.02 sec) mysql> mysql> DESC employee; +-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default |
Extra | +-------------+-------------+------+-----+---------+----------------+
| ID | Int (2) | NO | PRI | NULL | auto_increment | | first_name | varchar (20) | YES | | NULL | |
| last_name | varchar (30) | YES | | NULL | |
| start_date | Date | YES | | NULL | |
| Salary | Int (6) | YES | | NULL | |
| City | varchar (20) | YES | | NULL | |
| Description | varchar (20) | YES | | NULL |
|
+-------------+-------------+------+-----+---------+----------------+7 Rows in Set (0.00 sec)
Above is the MySQL desc data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!