需要数据库设计规范化帮助 (5nf)

发布于 2024-09-13 04:50:36 字数 682 浏览 3 评论 0原文

你们能告诉我如何得到第五范式的 ERD 吗?昨天我们做了一个课堂作业,有一位真正的客户进来并向我们解释他的需求,我的小组提出了这个模型,我正在尝试更进一步,看看我是否可以将其达到第五范式,以便我可以更好地理解它,因为下周我们将做另一个小组 ERD,这必须在 5nf 中,但问题是我不知道从哪里开始,而且这本书对我来说也没有理解。你们能帮帮我吗。Erd 模型 http://img534.imageshack.us/img534/ 2118/capturekk.jpg

新信息“假客户需求”

客户有 2 个部门“实验室 1, 实验室 2”,从中订购医疗用品 他,比如手套和pi宠物等等。 部门已经扩大,他 想要跟踪其中的内容 库存供应商正在销售的产品 谁的价格最优惠以及成本是多少 它来自中心。

他的方式 解释说订购的商品是 一个人去找他并要求 然后他写下哪个实验室 该人来自该人的名字 以及在哪个成本中心计费。但他 也想追踪已经发生的事情 按购买日期和库存情况 以及必须购买什么。他还 举了一些用户想要的例子 来自特定供应商的物品 可能没有最优惠的价格,他 还收到一些目录 邮件中也附有他想要的价格 跟踪。

如果内容混乱,我深表歉意,但这都是我的记忆。

Can you guys show me how to get this ERD in 5th normal form? We did a class assignment yesterday where we had a real client come in and explain to us his need my group came up with this model I am trying to take it a step further and see if I can get it to 5th normal form so that I can understand it better as next week we will be doing another group ERD that will have to be in 5nf the thing is I don't know where to start and the book is not getting through to me. can you guys help me.Erd Model http://img534.imageshack.us/img534/2118/capturekk.jpg

New information "Fake Clients Needs"

The client has 2 departments "Lab 1,
Lab 2" that order medical items from
him, like gloves and pi pets etc..
the departments have grown and he
wants to keep track of what is in
inventory what the vendors are selling
who has the best price and what cost
center it came from.

The way he
explained it the item is ordered is that
an individual goes to him and asks for
supplies he then writes down what lab
the person is from the persons name
and what cost center to bill. but he
also wants to track what has been
purchased by date and what is in stock
and what has to be bought. He also
gave an example that some users want
items from a specific vendor that
might not have the best prices and he
also receives some catalogs in the
mails with prices too that he wants to
track.

I apologize if its jumbled but this is all from memory.

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

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

发布评论

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

评论(2

几味少女 2024-09-20 04:50:36

我要挺身而出,说你当前的模式实际上不具备 5NF 的资格。引用维基百科的话,它说大多数 4NF 表已经符合 5NF:

仅在极少数情况下才会使用
4NF 表不符合 5NF。这些
是一种复杂的情况
现实世界的约束
属性值的有效组合
4NF 表中并不隐含
该表的结构。如果有这样一个
表未标准化为 5NF,
维持逻辑的负担
内数据的一致性
表必须部分由
应用程序负责
插入、删除和更新
它;并且风险较高
表中的数据将
变得不一致。相比之下,
5NF 设计排除了以下可能性:
这种不一致。

http://en.wikipedia.org/wiki/Fifth_normal_form

也许目的不是为了您的数据库 5NF,但要了解它与 5NF 相比的结构,并论证为什么它可能已经在 5NF 中。

更新:从评论中阅读某种形式的共识,看来您的设计可能已经处于 5NF 中,无论是有意为之还是之前规范化过程中的意外。

I'm going to stick my neck out and say your current schema doesn't really have any eligibility for 5NF. Taking a quote from wikipedia, it says most 4NF tables already conform to 5NF:

Usage Only in rare situations does a
4NF table not conform to 5NF. These
are situations in which a complex
real-world constraint governing the
valid combinations of attribute values
in the 4NF table is not implicit in
the structure of that table. If such a
table is not normalized to 5NF, the
burden of maintaining the logical
consistency of the data within the
table must be carried partly by the
application responsible for
insertions, deletions, and updates to
it; and there is a heightened risk
that the data within the table will
become inconsistent. In contrast, the
5NF design excludes the possibility of
such inconsistencies.

http://en.wikipedia.org/wiki/Fifth_normal_form

Perhaps the purpose is not to make your database 5NF, but to understand it's structure compared to 5NF and make an argument for why it might already be in 5NF.

Update: reading some form of consensus from the comments, it seems your design may already be in 5NF, whether it was by design or by accident from a previous normalization pass.

恬淡成诗 2024-09-20 04:50:36

免责声明:在不了解您的业务逻辑的情况下,我对以下一些建议可能是完全错误的。

好的,我在您的数据库架构中看到了一些内容。

  1. 您的成本中心表看起来既是查找表又是关联表。因此,如果您有一定数量的成本中心,例如 5 个,但有 1000 个用户,那么该表将有 5000 条记录,所有记录都存储成本中心名称(假设成本中心分配对于每个用户来说不是唯一的)。您可能希望将用户关联拆分到一个单独的表,该表具有自己的 costcenterId 和 userId 的 PK 和 FK。
  2. 您的库存表(我假设它存储了某件商品的现有库存量)应该只需要现有数量,但不确定描述的用途。如果每个商品库存的描述不是唯一的,您可能需要将其拆分到它自己的查找表中,并在库存表中引用它。
  3. 您正在供应商表中存储“lineQuantity”。这个专栏是干什么用的。听起来它以某种方式与特定订单相关(购买的商品数量?)如果是这样,您将需要将其拆分到自己的表中,并将其与订单而不是供应商相关联。在不确切知道 lineQuantity 是什么的情况下,尽管这个建议可能是完全错误的。
  4. 最后的建议不确定这对你的班级是否重要。您将所有数据类型定义为 CHAR(10),您可能希望将这些数据类型更改为您将用于数据库的实际数据类型。

Disclaimer: Without knowing your business logic I could be completely wrong with some of the following suggestions.

Ok a few things I saw in your database schema.

  1. Your cost center table looks to be both a lookup and association table. So if you have a set amount of cost centers lets say 5 for instance but a 1000 users then this table will have 5000 records which all store the cost center name (this is assuming that the cost center assignment is not unique to each user). You might want to split off the user association to a separate table which has it's own PK and FKs of costcenterId and userId.
  2. You inventory table, which I assume stores amount of stock on hand for an item, should only need an onhand quantities not sure what the description is for. If the description isn't unique to each item inventory you might want to split that off into it's own lookup table and reference it in the inventory table.
  3. You are storing "lineQuantity" in the vendor table. What is this column for. It sounds like it relates to a specific order in some way (quantity of item purchased?) If so you will want to split it off into it's own table and associate it with the order not the vendor. without knowing exactly what lineQuantity is though this suggestion could be completely wrong.
  4. Last suggestion not sure if this matters for your class. You are defining all your datatypes to be CHAR(10) you might want to change these to be the actual datatypes you would use for the database.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文