I'm seeking input/advice on a design issue.
I have a DB I'm designing that has an Individual (IND) entity, Organisation (ORG) entity, and a Membership (MBS) entity.
Each IND can have none or one MBS, the same with ORG. Each MBS has one of either IND or ORG (ie; one or the other, but it must have something).
So far, I've seen two ways to go about this:
1.
Having an INDid and ORGid field in MBS. Each MBS entity instance will have either the Primary Key of IND in the INDid field and a NULL in the ORGid field, or the Primary Key of ORG in the ORGid field and a NULL in the INDid field (so two one-to-one relationships where on its own each reference is optional from MBS to IND/ORG, but it is mandatory to have at least one of those references).
There's an additional field to specify the type of Membership: IND or ORG, to allow the system to know what attribute in MBS to refer to.
2.
Having an INDORG field that holds the PK of either the IND or the ORG entity, with the additional Membership type field indicating which entity (IND or ORG) to reference.
I began the design with option 1, but now I'm inclined to go with option 2, as it doesn't require a relationship, and that part of the system won't require referential integrity such as delete/update cascades.
Any thoughts or ideas? Other ways to model it? I hope I've explained it clearly.
I have a DB I'm designing that has an Individual (IND) entity, Organisation (ORG) entity, and a Membership (MBS) entity.
Each IND can have none or one MBS, the same with ORG. Each MBS has one of either IND or ORG (ie; one or the other, but it must have something).
So far, I've seen two ways to go about this:
1.
Having an INDid and ORGid field in MBS. Each MBS entity instance will have either the Primary Key of IND in the INDid field and a NULL in the ORGid field, or the Primary Key of ORG in the ORGid field and a NULL in the INDid field (so two one-to-one relationships where on its own each reference is optional from MBS to IND/ORG, but it is mandatory to have at least one of those references).
There's an additional field to specify the type of Membership: IND or ORG, to allow the system to know what attribute in MBS to refer to.
2.
Having an INDORG field that holds the PK of either the IND or the ORG entity, with the additional Membership type field indicating which entity (IND or ORG) to reference.
I began the design with option 1, but now I'm inclined to go with option 2, as it doesn't require a relationship, and that part of the system won't require referential integrity such as delete/update cascades.
Any thoughts or ideas? Other ways to model it? I hope I've explained it clearly.