Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get available values for SET field?

Tags:

mysql

Is there any way to get available values for SET field in table?

Thank you.

like image 254
Kirzilla Avatar asked Apr 12 '10 13:04

Kirzilla


1 Answers

You can retrieve the possible values for a SET field using DESCRIBE myTableName mySetColumn or SHOW COLUMNS FROM myTableName LIKE mySetColumn:

  mysql> DESCRIBE myTableName mySetColumn;
  +-------+-------------------------------------------+------+-----+---------+-------+
  | Field | Type                                      | Null | Key | Default | Extra |
  +-------+-------------------------------------------+------+-----+---------+-------+
  | myset | set('Travel','Sports','Dancing','Dining') | YES  |     | NULL    |       |
  +-------+-------------------------------------------+------+-----+---------+-------+

Informative article here, manual here.

like image 56
Andy Avatar answered Sep 27 '22 02:09

Andy