I would like to store an object FOO in a database.
Lets say FOO contains three integers and a list of "Fruits".
The list can have any length, the only thing I know is that the all the fruits allowed are stored in another table.
Can I store the fruit list in a column?
Best Solution
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.
To add Apple fruit to the list of a specific FOO object with ID=5, you would: