Relationship advice

  • Hello,

    I'm trying to put together a simple conceptual ER model and have a quick question relating to a couple Entities.

    The Entities in question are - Organisation, Company and Charity. Business rules dictate that an Organisation can have either a CompanyNumber a CharityNumber, Both or None.

    I'm having a few problems (which I’m sure are very basic) in deciding on the best way to represent this.

    If anyone has any suggestions, if to just tell me how bad my current solution is then that would be great.

    many thanks

  • can any Organization have more than one CompanyNumber a CharityNumber?

    if the answer is no/never , i'd put those columns in the Organization table; if the answer is maybe/not sure, i'd pull out the relationship similar to what you were doing, but i'd have the table with three columns OrganizationID,CompanyNumberID and CharityNumberID, instead of the way you have CompanyNumber and CharityNumber in a many to many.

    actually, to avoid having nulls and updating issues, i'd just have two one-to many relationship tables, one with OrganizationID and CompanyNumberID , and the other with OrganizationID and CharityNumberID

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell many thanks for the advice.

    An organisation will only ever have a maximum of one of each number. How ever each of the Entitys (company, charity) will have a quite a few unique attributes of their own. Therefore I guess it would be better to split them into three Separate entities (?).

    I've defined a 0-1 to 0-1 each of the relationships so hopefully that should model what I need.

    If you think I'm on the wrong path then please let me know otherwise many thanks again for the advice.

    ...EDIT. Going to update the relationship type to not allow NULLs.

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

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