Astora
Astora

Reputation: 725

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?

Upvotes: 0

Views: 1879

Answers (1)

Venkataraman R
Venkataraman R

Reputation: 12959

You can do below things:

  • Create Table : MembershipType

    • Id
    • MembershipTypeName
  • Add Two columns to Membership table

    • MembershipTypeId
    • MemberId

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

Related Questions