Reputation: 725
I am reading this post about arcs from data modeling.
This example says:
Arcs are a way to represent mutually exclusive relationships in the ERD. This arc represents the exclusive OR relationship – each MEMBERSHIP must be held by one COMPANY or must be held by one CUSTOMER, but not both.
My doubt is: how do I implement this physically in database? Do I need to create I trigger or something else to validate one or other, but not both at the same time? or if is there some constraint to use in this case?
Upvotes: 0
Views: 1879
Reputation: 12959
You can do below things:
Create Table : MembershipType
Add Two columns to Membership table
You need to make sure that MembershipTypeId, MemberId combination is unique, so that you can identify whether the membership is being held by Customer or Company.
Upvotes: 2