要显示,请使用DESC命令或information_schema.columns。让我们首先创建一个表并设置选项-
mysql> create table DemoTable
(
Color SET('RED','GREEN','BLUE','YELLOW')
);
这是使用DESC命令获取SET可用选项列表的查询-
mysql> desc DemoTable;
这将产生以下输出-
+-------+------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------------------------+------+-----+---------+-------+
| Color | set('RED','GREEN','BLUE','YELLOW') | YES | | NULL | |
+-------+------------------------------------+------+-----+---------+-------+
1 row in set (0.00 sec)
这是使用information_schema.columns概念查询SET可用选项的列表-
mysql> select column_type from information_schema.columns
where table_name = 'DemoTable'
and column_name = 'Color';
这将产生以下输出-
+------------------------------------+
| COLUMN_TYPE |
+------------------------------------+
| set('RED','GREEN','BLUE','YELLOW') |
+------------------------------------+
1 row in set (0.01 sec)