Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MYSQL|Inserting values into SET datatype

Could anyone tell me how to insert data into SET column in SQL and modify it

Could changing of the value be like this?

 UPDATE table SET set_column='a',' b',' c'

and inserting

INSERT INTO table(int_column,set_column) 
VALUES (126,('a','b'))
like image 531
StykPohlavsson Avatar asked Dec 04 '25 23:12

StykPohlavsson


1 Answers

That's not how you do sets: http://dev.mysql.com/doc/refman/5.7/en/set.html

INSERT ... VALUES (intval, 'set,values,here')
                           ^---^------^----^

Note that the set value is basically just a CSV string. One single string value, with multiple values separated by a comma inside that string.

like image 55
Marc B Avatar answered Dec 07 '25 14:12

Marc B