与连接实体有关系吗?

发布于 2024-10-21 01:59:43 字数 72 浏览 4 评论 0原文

在两个实体之间的多对多关系上,之间会有一个连接实体。

我的问题是,连接实体可以与另一个实体有关系吗?谢谢你! (:

On many to many relationship between two entity, there will be a junction entity in between.

My question is, can the junction entity have relationship with another entity? Thank you! (:

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

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

发布评论

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

评论(2

滿滿的愛 2024-10-28 01:59:43

是的。如果新实体与关系相关而不是两个父实体相关,那么这绝对是可能的。

一个例子:假设您想要跟踪客户为某一特定购买(产品)所做的付款。您将拥有三张桌子。

Customer
----------
Customer_ID,
Customer_Name

Product
-------
Product_id,
Product_name

Purchase (Customer-product-association).
-------------------------------------------
purchase_id,
Customer_ID (FK)
Product_ID (FK)
total_transaction_amt.

Payments (child of purchase)
-------------------------------
Payment_id,
purchase_ID

上面的付款表与采购表(这是一个联结实体)存在父子关系。其他关系(例如多对多)同样有效。

Yes. If the new entity is related to the relationship instead of the two parent entities, then it is definitely possible.

One example :Let's say you want to track the payments made for a particular purchase (of a product) by a customer. You will have the three tables.

Customer
----------
Customer_ID,
Customer_Name

Product
-------
Product_id,
Product_name

Purchase (Customer-product-association).
-------------------------------------------
purchase_id,
Customer_ID (FK)
Product_ID (FK)
total_transaction_amt.

Payments (child of purchase)
-------------------------------
Payment_id,
purchase_ID

The Payments table above is in a parent-child relationship with the Purchase table (which is a junction entity). Other relationships (such as many-to-many)are equally valid.

攀登最高峰 2024-10-28 01:59:43

当然可以。通常,连接实体是“弱”实体,这基本上意味着它依赖于另一个实体。但对于那个弱实体来说,与另一个实体建立关系是完全合法的。

举例来说,您有一个简单的审核系统。审计由多个部分组成。每个部分都在单独的表中预定义。因此,您有 audit_definition(其中包含审核定义详细信息)、section_type(其中包含节模板)和 audit_section_definition(将两者连接起来)您知道该类型的每次审核要使用哪些部分。

然后您就有一个audit_instance 表,其中包含该审核类型的实际审核。要存储该审核实例的部分详细信息,您需要一个 section_instance 表。完全可以想象,您需要从 section_instanceaudit_section_definition 的链接,即使后者是联结实体。

Sure it can. Typically a junction entity will be a "weak" entity, meaning basically that it's dependent on another entity. But it's perfectly legal for that weak entity to have a relationship with another entity.

Say, for example, you have a simple auditing system. The audit is made up of sections. Each section is predefined in an separate table. So you have audit_definition, which contains the audit definition details, section_type, which contains the section template, and audit_section_definition, which connects the two so that you know which sections to use for each audit of that type.

Then you have an audit_instance table, which contains actual audits of that audit type. To store the section details for that audit instance, you have a section_instance table. It's entirely conceivable that you would need a link from section_instance to audit_section_definition, even though the latter is a junction entity.

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