Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Show the list of columns within a given table.
SHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name] [LIKE 'pattern' | WHERE expr]
LIKE
‘pattern’ can be used to filter the list by name. SQL LIKE clause.WHERE expr
can be used to filter the results by other predicates. SQL WHERE clause.Output
Column | Description |
---|---|
Field |
Field name |
Type |
Data type (see :ref:data_types ) |
Null |
Whether this column allows nulls |
Key |
Key |
Default |
Default value, if applicable |
Extra |
Additional information |
SHOW COLUMNS IN mytbl;
+----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+-------+
| seq | int(11) | YES | MUL | NULL | |
| state | int(11) | YES | | NULL | |
| st_case | varchar(8) | YES | | NULL | |
| veh_no | varchar(2) | YES | | NULL | |
| drimpair | varchar(2) | YES | | NULL | |
+----------+------------+------+-----+---------+-------+
5 rows in set (0.00 sec)