Re: variable number of foriegn keys

From: Alan Anderson <aranders_at_kosepc01.delcoelect.com>
Date: 1995/10/13
Message-ID: <45lrc8$hec_at_kocrsv08.delcoelect.com>#1/1


yoosh_at_sawnlk.cs.ualberta.ca (Yoo-Shin Lee) writes:
>
>Hello,
>
>I want to associate a variable number of foreign keys to a record:
>
> Example record of a house
>
> House Address: 4016-99 street
> Description: a little red house
> Family Members: john, mary, martha /* THIS IS THE variable field
>
>So the Family Members field is taken from a relation people:
>
> Example record in people
>
> Name: john /* this is the primary key in people
> Age: 22
> favorite food: pizza

You've got this conceptually backwards. The house doesn't associate itself with multiple people; each person is associated with a house. "First normal form" dictates that there be no repeating groups.

The "correct" way to do this is:

  HOUSE:
    House Address: 1313 Mockingbird Lane     Description: a Gothic horror

  PEOPLE:
    Name: Marilyn
    Resides at: 1313 Mockingbird Lane

Each person has only one address, and there is no "multiple" data.

  • === === === = = = === === === === = = === = = = === = = === = # Alan Anderson # Ignorance can be fixed, but stupidity is permanent. # (I do not speak for Delco Electronics, and DE does not speak for me.)
Received on Fri Oct 13 1995 - 00:00:00 CET

Original text of this message