Purpose
You can use this statement to query the schema of a table or column.
EXPLAIN, DESCRIBE, and DESC are synonyms.
Syntax
{EXPLAIN | DESCRIBE | DESC} table_name [column_name | wild];
Parameters
| Parameter | Description |
|---|---|
| table_name | The table name. |
| column_name | The column name of the table. |
Examples
Query the definition of table
t1.obclient> 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 setQuery the definition of column
c1in tablet1.obclient> DESCRIBE t1 c1; +-------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | c1 | int(11) | NO | PRI | NULL | | +-------+---------+------+-----+---------+-------+ 1 row in set