Skip to main content

SHOW COLUMNS

Description​

This statement is used to specify the column information of a table.

Syntax​

SHOW [ FULL ] COLUMNS FROM <tbl>;

Required Parameters​

1. <tbl>

The name of the table for which column information needs to be viewed must be specified.

Optional Parameters​

1. FULL

If the FULL keyword is specified, detailed information about the columns will be returned, including the aggregation type, permissions, comments, etc. of the columns.

Return Value​

ColumnDataTypeNote
FieldvarcharColumn Name
TypevarcharColumn Data Type
CollationvarcharColumn Collation
NullvarcharWhether NULL is Allowed
KeyvarcharTable's Primary Key
DefaultvarcharDefault Value
ExtravarcharExtra Info
PrivilegesvarcharColumn Privileges
CommentvarcharColumn Comment

Access Control Requirements​

Requires the SHOW privilege for the table to be viewed.

Examples​

  1. View detailed column information of the specified table
SHOW FULL COLUMNS FROM t_agg;
+-------+-----------------+-----------+------+------+---------+---------+------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-----------------+-----------+------+------+---------+---------+------------+---------+
| k1 | tinyint | | YES | YES | NULL | | | |
| k2 | decimalv3(10,2) | | YES | YES | 10.5 | | | |
| v1 | char(10) | | YES | NO | NULL | REPLACE | | |
| v2 | int | | YES | NO | NULL | SUM | | |
+-------+-----------------+-----------+------+------+---------+---------+------------+---------+
  1. View the normal column information of the specified table
SHOW COLUMNS FROM t_agg;
+-------+-----------------+------+------+---------+---------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------+------+------+---------+---------+
| k1 | tinyint | YES | YES | NULL | |
| k2 | decimalv3(10,2) | YES | YES | 10.5 | |
| v1 | char(10) | YES | NO | NULL | REPLACE |
| v2 | int | YES | NO | NULL | SUM |
+-------+-----------------+------+------+---------+---------+