Re: multi-valued field?
Posted in 1997
Topics: Triggers, Constraints & Referential Integrity, Licensing & Editions
>> Kevin Kane wrote: >> > >> > Hi. Is there such a thing in DB2 as a multi-valued field? By this I mean >> > that I have a column called, say, AUTOMOBILES. If a person has 2 >> > cars, then I would like the AUTOMOBILES field of his record to contain >> > 2 entries, one for each car. >> > >> > So, can DB2 handle this, or am I just going to have to cat the >> > individual values together into a character string with some kind of >> > delimiter? You aren't coming from a PICK environment are you? It can be done in a SQL database. The way to do it is to create a 2nd table for AUTOMOBILES (and all associated fields). This is called normalziation. Whatever you're using as the primary key for the OWNER table becomes a foreign key in the AUTOMOBILE table. OWNER ======= owner_no PK name address etc. AUTOMOBILES =========== auto_no PK owner_no FK reference to OWNER description license_no etc. -- Chuck Hamilton chuckh@dvol.com This message delivered by electronic sled dogs. WOOF!