Skip to main content

DESCRIBE

Description

This statement is used to retrieve the schema information of a table or column.

EXPLAIN is a synonym of DESCRIBE and DESC.

Syntax

{EXPLAIN | DESCRIBE | DESC} table_name [column_name | wild];

Parameters

ParameterDescription
table_nameThe name of the table.
column_nameThe name of the column in the table.

Examples

  • Show the definition of table t1.

    DESCRIBE t1;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | c1 | int(11) | NO | PRI | NULL | |
    | c2 | int(11) | YES | | NULL | |
    | c3 | varchar(20) | YES | | NULL | |
    +-------+-------------+------+-----+---------+-------+
    3 rows in set (0.002 sec)
  • Show the definition of column c1 in table t1.

    DESCRIBE t1 c1;
    +-------+---------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +-------+---------+------+-----+---------+-------+
    | c1 | int(11) | NO | PRI | NULL | |
    +-------+---------+------+-----+---------+-------+
    1 row in set (0.001 sec)