Reputation: 23
I wanted to ask how I insert a record with the mysql SET type. Lets assume the following table:
user_id
int(8)
and
user_rights
set('conversation','offer','turnover','financial','admin');
How would my INSERT query be?
Thanks in advance
Upvotes: 0
Views: 110
Reputation: 68790
Use single quotes around your choices (doc). You can set multiple choices :
INSERT INTO users(user_id, user_rights) VALUES
(1, 'conversation,offer,turnover,financial,admin'),
(2, 'conversation,financial'),
(3, 'conversation'),
(4, 'conversation,offer,financial');
Upvotes: 4
Reputation: 1596
Here is an example :
INSERT INTO yourTable SET user_id=7, user_rights='admin';
See INSERT documentation.
Upvotes: 2