sqldata-modeling

Arcs - data modeling


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.

enter image description here

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?


Solution

  • You can do below things:

    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.