开发者

Database design normalization help needed (5nf)

开发者 https://www.devze.com 2023-01-10 04:03 出处:网络
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 try

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 t开发者_运维问答rack 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.


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.


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消