MySQL desc (DESCRIBE) command instance to explain _php tips

Source: Internet
Author: User

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:

    1. Fields Name (field)
    2. field type (type)
    3. Whether the field is null
    4. Whether the field is a primary key (key)
    5. Default value for field
    6. 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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.