I've got a table of values, and among the posts being of type SET.

Whether it presently has got the people ('a', 'b', 'c', 'd'), how do you add 'e' towards the possible values?

I recognize that utilizing a SET type is a touch strange, and I am unclear why you might utilize it rather than an overseas answer to another table using the values from the set, however i did not design the database under consideration, and should not change it out much.

Interesting help!

UPDATE: I wish to update the SET type for all rows, not merely one, in the event that helps.

You need to add 'e' towards the allowable values for the reason that set area, or it's already there and you need to add 'e' to the present worth of the set area for the reason that table?

When not already an permitted value, then you will need to do an ALTER TABLE and redefine the area:

 ALTER TABLE set_test CHANGE myset myset SET('a','b','c','d','e');

(yes, 'myset' is defined inside two times, it is a "currentname newname" kind of factor.)

Otherwise simply do an UPDATE TABLE and concat the area with 'e' because the previous answer states.

To include a component for an existing SET make use of the CONCAT() function to include the brand new element for your comma separated list. To utilize decimal values, we are able to make use of the bitwise OR operator .

  UPDATE set_test SET myset = CONCAT(myset,",Travel")
      WHERE rowid = 3;

or

  UPDATE set_test SET myset = myset | 1 WHERE rowid = 3;

You may also make use of the CONCAT_WS() function, which handles list separators for all of us:

  UPDATE set_test SET myset = CONCAT_WS(',',myset,'Dancing')
      WHERE rowid = 6;