mysql

How to get available values for SET field?


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

Thank you.


Solution

  • 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.