ARCS-数据建模

发布于 2025-01-22 22:07:10 字数 519 浏览 0 评论 0原文

我正在阅读 this 有关数据建模的弧的文章。

这个示例说:

弧是代表相互排斥关系的一种方式 ERD。 该弧代表独家或关系 - 每个关系 会员资格必须由一家公司持有,或者必须由一家公司持有 客户,但不是两者。

我的疑问是:如何在数据库中进行物理实现?我是否需要创建我的触发器或其他东西来验证一个或另一个,但并非同时验证?还是在这种情况下是否有一些限制?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

澜川若宁 2025-01-29 22:07:10

您可以在以下操作:

  • 创建表:会员tatepe

    • id
    • 会员类型
  • 将两个列添加到会员表

    • 会员类型
    • 成员

您需要确保会员类型,会员组合的组合是独特的,以便您可以确定会员资格是由客户还是公司持有的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文