How to store a list in a db column
Solution 1:
In a normalized relational database, such a situation is unacceptable. You should have a junction table that stores one row for each distinct ID of the FOO object and the ID of the Fruit. Existence of such a row means the fruit is in that list for the FOO.
CREATE TABLE FOO (
id int primary key not null,
int1 int,
int2 int,
int3 int
)
CREATE TABLE Fruits (
id int primary key not null,
name varchar(30)
)
CREATE TABLE FOOFruits (
FruitID int references Fruits (ID),
FooID int references FOO(id),
constraint pk_FooFruits primary key (FruitID, FooID)
)
To add Apple fruit to the list of a specific FOO object with ID=5, you would:
INSERT FOOFruits(FooID, FruitID)
SELECT 5, ID FROM Fruits WHERE name = 'Apple'
Solution 2:
If you're quite sure of what you're doing (ie. you won't need to look up the list's values, for example), you could also serialize your object, or just the list object, and store it in a binary column.
Just character-separating the values may be fine too, and cheaper in terms of saving and loading, but be careful your data doesn't contain the separator character, or escape it (and handle the escapes accordingly while loading, etc... Your language of choice may do a better job at this than you, though. ;) )
However, for a "proper" solution, do what Mehrdad described above.
Solution 3:
Its technically possible but would be very poor design, imo.
You could do it by building the string and storing it in a nvarchar(max) field (if using sql server or its equivalent).
Solution 4:
You can, but it will likely treated as text, making searching in this column difficult and slow. You're better of using a related table.