Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    26

    Company Person Realationship

    I have a schema question about a database I am putting together. The database will be used to track the contact information and dialogs we have with people at the various companies we work with. These people may leave a company to work somewhere else but I want the relationships that the letter creates, both to the company and person to be preserved in the DB. In the future I can call a company, and in the past I spoke with so and so, or call the person and see that while there were at the previous company we discusses this and that. What is the best way to set this up in the DB?

    1. have a table that has a primary key of say "PersonCompany" and then foreign key of "Company" and foreign key of "Person". So if I want to log a letter to a person at a company I would just use the PersonCompany PK and the letter would always have association with both entities (person and company)

    2. Instead of a single value (PK) to capture the relationship between a person and company. Should I use two foreign keys, one for the person and one for the company, to indicate the letter has a relationship to both entities.

    Both methods seem to work, but I'm wondering what is the most appropriate way to set up this relationship.

    Thanks,
    Dave

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    If the letter was addressed to a person, regardless of what company they were associated with at the time of the letter, then maintaining an employment history on the person would enable you to determine their employer when the letter was sent.
    If the letter was addressed to a person, at a particular company, then both person and company are attributes of the letter, and should be stored in the record for the letter.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •