I want to create a MySQL database with one column containing a list(variable in size for different entries). I also have to allow ent开发者_开发问答ries to be added to that list later. What is the way to do this ?
The way this is typically done is to create a separate column that groups the items together:
list_id, value
1, a
1, b
1, c
2, e
2, f
SELECT value FROM table WHERE list_id = 1
will return three rows: (a, b, c)
Adding a new value x into list_id 2 would be something like this:
INSERT INTO table VALUES(2, 'x')
精彩评论