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