Purpose
This statement is used to retrieve schema information for a table or column.
EXPLAIN, DESCRIBE, and DESC are synonyms.
Syntax
{EXPLAIN | DESCRIBE | DESC} table_name [column_name | wild]
Parameters
| Parameter | Description |
|---|---|
| table_name | Specifies the table name. |
| column_name | Specifies the column name of the table. |
Examples
Display the definition of table
t1.obclient> DESCRIBE t1;Expected return result:
+-------+-------------+------+-----+---------+-------+ | 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 setDisplay the definition of column
c1in tablet1.obclient> DESCRIBE t1 c1;Expected return result:
+-------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | c1 | int(11) | NO | PRI | NULL | | +-------+---------+------+-----+---------+-------+ 1 row in set
