Database Modeling Help Needed

  • Hi there,

    I'm currently designing a database model but am having some difficulties linking some of the tables together. If someone could have a look at what I'm trying to do and help me out if possible, I would be really greatful.

    -------------          -------------

    |  CONTACT  |          |   GROUP   |

    -------------          -------------

          |                      |

         /|\                    /|\

    -------------          -------------

    | PROFILING |          |   VALUE   |

    -------------          -------------

     

    Contact Table

    Contains personal details about an individual.

    Group

    Contains title for a grouping of contacts. Grouping examples are; over 50 years old (yes/no) or Job Type (manager, director, monkey boy etc..) A group can therefore be a yes/no or multiple value type.

    Values

    Contains all the values possible for all the groupings.

    Profiling

    Links a contact with both a group and the value selected for the group.

    I know how to link the Contact & Profiling tables together and the Group & Values tables. However, I'm not sure how the two separate groups link with each other.

    I need to be able to select all the groups a contact has been associated with and the value for the group. I also need to be able to select all the possible values for a group.

     

    Thanks in advance...

    Jonathan

  • If I understand what you're trying to do, you might want something like this (wherever I put "etc" it's because I assume you may have other attributes you need to include in that table):

    Contact (ContactID, ContactName, etc)

    Group (GroupID, GroupName, etc)

    Value (ValueID, GroupID (fk), Value, etc)

    Profiling (ProfilingID, ContactID (fk), ValueID (fk), etc)

    Here's some sample data showing that I am not (in fact) over 50, but that my father is over 50:

    Contact: (ContactID: 1, ContactName: 'Chris Leonard', etc)

    Contact: (ContactID: 2, ContactName: 'Chris''s Father', etc)

    Group: (GroupID: 10, GroupName: Over 50, etc)

    Value: (ValueID: 100, GroupID: 10, Value: 'No', etc)

    Value: (ValueID: 101, GroupID: 10, Value: 'Yes', etc)

    Profiling: (ProfilingID: 1000, ContactID: 1, ValueID: 100, etc)

    Profiling: (ProfilingID: 1001, ContactID: 2, ValueID: 101, etc)

    There are other ways to do this, but is that basically what you're trying to get at? 

    Cheers,

    Chris

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply