In a normalized relational database, this situation is unacceptable. You should have a connection table that stores one row for each individual FOO object identifier and Fruit identifier. The existence of such a string means that the fetus is on this list for 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 must:
INSERT FOOFruits(FooID, FruitID) SELECT 5, ID FROM Fruits WHERE name = 'Apple'
Mehrdad Afshari Jan 14 '09 at 19:09 2009-01-14 19:09
source share