Hi,
I'm designing a database where i have some tables about contacts. What i
would like to know is what the best design is for creating contacts.
I have a table relations where i store persons name and company names. Now
to determine the relation where who is related to who, e.g. a company and
their contacts or a family with their family members, i need some sort of a
recursive table/query.
Can anyone help me with this or is what i want not the right way?First of all you have to know what are your entities an their atributes,
after that need to know what kind of relation you want, then you determine
the cardinality of it, and only at the end of work you will see if is
necessary some other indexes or special constraints and can evaluate the
performance.
Ex:
The entitys and atributes are:
Family (familyid, familyname) and Family members (memberid, membername)
If you want a family have various members and a member is on only one
family, then it is a 1 to N relation.
Then you will model your tables (2 tables and 1 relation) like:
Family (familyid as PK, familyname) <- Family members (memberid as PK,
familyid as PK and FK, membername)
If you want a family have various members and a member is on more than one
family, then it is a N to N relation.
Then you will model your tables (3 tables and 2 relations) like:
Family (familyid as PK, familyname) <- Familymembers (memberid as PK and FK,
familyid as PK and FK)
Members (memberid as PK, membername) <- Familymembers (memberid as PK and
FK, familyid as PK and FK)
It seems you need to study a little about normalization. ; )
--
Regards
BMartins (Brazil)
"Jason" <jlewis@.homail.com> escreveu na mensagem
news:OiGcCjJNFHA.2680@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I'm designing a database where i have some tables about contacts. What i
> would like to know is what the best design is for creating contacts.
> I have a table relations where i store persons name and company names. Now
> to determine the relation where who is related to who, e.g. a company and
> their contacts or a family with their family members, i need some sort of
a
> recursive table/query.
> Can anyone help me with this or is what i want not the right way?
>