无法将此类型的ER图转换为SQL或关系表 [英] Can't convert this type of ER diagram into SQL or relational tables

查看:85
本文介绍了无法将此类型的ER图转换为SQL或关系表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库设计过程中偶然发现了一个问题。让我解释它的全部内容:



合约有一些描述他的简单属性,可能有附件和支付动态。



因此我决定制作主表合约,并将简单属性作为列放置。



付款动态是合约表的复杂属性。它可以没有,一个或多个值。通过互联网搜索我了解到这被称为多值属性,并找到此示例 [ ^ ]这似乎很好地说明了我的情况(支付动态相当于链接示例中的爱好表)。



至于附件,它是合同的复杂属性。合同可以有很多,一个或者没有。



附件与合同具有完全相同的简单属性,也可以有动态付款。附件与支付动态的关系与合同和支付动态之间的关系相同。



总结一下,附件和合同的一切都是一样的,唯一的区别是附件是合同的复杂属性。



使用这个 [ ^ ]作为参考,我制作了 ER图的草图[ ^ ]。



这是我第一次看到这种关系,所以我请社区帮我将这个ER图转换成SQL或关系表。



我为没有提供更多信息而道歉如果您有进一步的要求,请发表评论,我会立即更新我的帖子。



感谢您的理解和帮助。



祝你好运。

解决方案

现在我看了一下图表。我掀起了它的ASCII艺术版本,我建议的替代方案,这意味着删除Contract和Dynamic之间的直接关系。



 | ----------------- o< 
合约DYNAMIC
| ---- o<附件| --- o<



合同| -----<附件| --- o< DYNAMIC





如果合同具有ABCDEF属性,且附件具有DEF,则只需从合同中删除DEF并将其替换为附件。


I have stumbled upon a problem during database design. Let me explain what it is all about:

Contract has some simple attributes that describe him, and may have annexes and dynamics of payment.

Therefore I have decided to make main table Contracts, and placed simple attributes as columns.

Dynamics of payment is a complex attribute of Contracts table. It can have none, one or multiple values. Searching through the Internet I have learned that this is called multivalued attribute, and have found this example[^] that seems to illustrate my case very well ( Dynamics of payment is equivalent to the Hobbies table in the linked example ).

As for Annexes, it is a complex attribute of Contract. Contract can have many of them, one or none.

Annex has exactly the same simple attributes as contract, and can also have Dynamics of payment. Annex' relationship with Dynamics of payment is the same as the relationship between Contract and Dynamics of payment.

To sum-it-up, Annex and contract have everything the same, the only difference is that Annex is a complex attribute of Contract.

Using this[^] as a reference, I have made the sketch of my ER diagram[^].

This is the first time I see this type of relationships so I ask the community to help me convert this ER diagram into SQL or relational tables.

I apologize for not providing more info, if you have further requests please leave a comment and I will update my post immediately.

Thank you for your understanding and help.

Best regards.

解决方案

Now I have looked at the diagram. I whipped up an ASCII art version of it, and the alternative I propose, it means removing the direct relationship between Contract and Dynamic.

         |-----------------o<
CONTRACT                      DYNAMIC
         |----o< ANNEX |---o<



CONTRACT |-----< ANNEX |---o< DYNAMIC



If Contract has attributes ABCDEF, and Annex has DEF, then simply remove DEF from Contract and replace it with an Annex.


这篇关于无法将此类型的ER图转换为SQL或关系表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆