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?
CodePudding user response:
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.