show columns
功能
显示一个给定表中列的信息。
语法
SHOW [FULL] COLUMNS FROM
{ [vc_name.][database_name.]table_name|
table_name [FROM [vc_name.]database_name]}
[LIKE 'pattern']
参数说明
参数名称 | 说明 |
---|---|
FULL | 关键字 FULL 产生的输出,包括用户对每个列所拥有的权限。FULL 也显示所有列注释信息。 |
vc_name | vc名可选项。 |
database_name | 数据库名,可选项。 |
table_name | 表名。 |
pattern | 一个可以包含 SQL “%”和“_”通配符的字符串。 |
示例
gbase> show columns from t2 from testdb;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| v1 | varchar(10) | YES | | NULL | |
| v2 | varchar(10) | YES | | NULL | |
| v3 | varchar(10) | YES | | NULL | |
| v4 | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
4 rows in set (Elapsed: 00:00:00.00)
gbase> show columns from t2 like '%1%';
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| v1 | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
1 row in set (Elapsed: 00:00:00.00)
gbase> show full columns from testdb.t2 where type like '%varchar%' and "key"='';
+-------+-------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| v1 | varchar(10) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| v2 | varchar(10) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| v3 | varchar(10) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| v4 | varchar(10) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
+-------+-------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
4 rows in set (Elapsed: 00:00:00.00)