Database creation - relation

databases Croatia (Hrvatska)
  • 15 years ago

    I'm having problems creating table relation.

    Caller can be either a person from a company or a private person.
    Table "T_call" stores information about the person that made the call (a private person or a person from a company)

    Is this a good way of creating relations between tables?

    Any sugestions?


    T_City : PostNR, City

    TClientP : IDClientP, ClientPName, PostNR....                         (IDClientP - PK)   - private person

    TClientC : IDClientC, IDcompany, ClientCname...     (IDClientC - PK , IDcompany - FK)

    TCompany : IDcompany, Name, address, PostNR....                   (ID_company - PK)

    TCall : IDcall, IDClientP, IDClientC, Time....               (IDcall - PK, IDClientP - FK, ID_ClientC - FK)

    As you can see :

    "TCity" is related to "Tcompany" and "T_ClientP"  (one to many)

    "Tcompany" is related to "TClientC"  (one to many)

    "TClientC" is related to "TCall"   (one to many)

    "TClientP" is  related to "TCall"   (one to many)


    A -> B -> C ->D
    A -> E -> D

  • 15 years ago

    Since you asked multiple times, you get multiple awnsers:

    Hi, I think the structure of the tables and relations should depend on the information that will be in it. For instandce if the clientP and clientC are for a large part identical then I think this would be a better structure:

    The table call has a many to one relation to the table clientperson
    the table client
    person has a zero to one relation with clientcompany
    company has a many to one relation with company
    So then it would be the A - B - C - D

    If clientperson and clientcompany are verry different, then you can use
    A - B
    A - C - D
    So then in the call table you would need 2 fields. one that point to clientperson and one that points to clientcompany

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski