从 EER 图形成关系

发布于 2025-01-08 19:41:12 字数 202 浏览 2 评论 0原文

我真的很想理解将 EER 图转换为关系的概念。我知道简单的属性必须直接映射到关系上。在处理复合属性和多值属性时出现了我的问题。你会为他们中的任何一个建立新的关系吗?例如,客户实体可能具有名称、地址和邮政编码。地址属性包含街道、城市、州和地址#。这是否意味着应创建新关系或应在客户关系中列出所有组件属性?最后,如何通过示例以易于理解的方式正确映射多值属性?

感谢您的任何帮助。

I'm really trying to wrap my head around the concept of transforming EER Diagrams into relations. I understand that simple attributes must be mapped directly on the relation. My problem arises when dealing with composite and multivalued attributes. Do you create new relations for either one of them? For example, a customer entity may have a name, address, and postal code. The address attribute contains street, city, state, and address #. Does this mean that a new relation should be created or all component attributes should be listed in the customer relation? And lastly how is a multivalued attribute properly mapped, in easy to understand terms with an example?

Thanks for any help.

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

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

发布评论

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

评论(1

楠木可依 2025-01-15 19:41:13

几乎可以肯定,将多值属性删除到单独的关系中会更好。这就是所谓的第一范式,你必须非常努力地找到一个可以证明违反 1NF 的例子。

没有理由为复合属性创建新关系。由于属性的基数及其对主键和候选键的依赖性,您将属性拆分为新的关系。

复合属性实际上并不存在于自然界中,它们是概念建模想象力的虚构。好吧,这个说法有点搞笑。关键是,当您将概念模型转变为物理模型时,您就需要针对实际业务需求做出决定。复合属性物理保留的粒度级别取决于您计划如何使用数据。如果您正在跟踪地址以打印信封或运输标签,您很可能决定将地址元素折叠为两列。另一方面,您可能认为您的业务需求需要地址元素分析,因此将地址的每个部分保留在其自己的列中更有意义。

Multivalued attributes are almost certainly better off being removed to a separate relation. That is called First Normal Form and you have to work pretty hard to find an example where violating 1NF can be justified.

There is no reason for creating a new relation for composite attributes. You split attributes into a new relation because of their cardinality and their dependency on your primary and candidate keys.

Composite attributes don't actually occur in nature, they are a figment of the conceptual modeling imagination. OK, this statement is slightly facetious. The point is that when you go past the conceptual model into a physical model, you have a decision to make about your practical business requirements. The level of granularity at which your composite attributes are persisted phyisically depends on how you plan to use the data. If you are tracking an address to print an envelope or shipping label, you may well decide to collapse your address elements into two columns. On the other hand, you may decide that your business requirements call for address element analysis so keeping each part of the address in its own column makes more sense.

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