Subject Re: [ib-support] One-to-one relationship
Author Helen Borrie
At 07:50 AM 16-05-01 +0200, you wrote:
>Hi list,
>
> Can someone explain to me what is the advantage of a one-to-one
>relationship ? I don't see any advantage on it, because a single record in
>the first table is related to only one record in the second table, so why
>don't put it all in one table then ?

I find optional 1:1 relationships useful for situations where I want to "mix and match" packets of information without needed to have horrendously wide rows potentially carrying a lot of "empty" columns, as the master to master-detail relationships.
For a simple example, in a medical application, I might have a "person" which carries with it some common attributes but also large packets of data which apply to some persons (e.g. medical history applies to patients whereas availability for a duty roster applies to doctors and nurses). I want to store names and some other details about all persons but I don't usually store medical history for doctors and nurses or roster availability for patients.

If a person exists, then s/he will always have one or more Address records; but the 1:1 allows me to store the optional (or conditional) info only if it is appropriate.

Cheers,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________