normalization transitive dependencies

▼魔方 西西 提交于 2019-12-08 03:35:01

问题


I need help with normalization. I am having trouble understanding how to complete the 3NF on my database project. Here is the 1NF

Normalized Table

Donut ID(PK)
Donut Name
Description
Unit Price
Donut Order ID
Qty
CustomerID
Last Name
First Name 
Last Name 
Street Address
Apt
City
State
Zip
Home Phone
Mobile Phone
Other Phone
Order Date 
Special Notes

2NF Donut Table

DonutID (PK)
Donut Name
Description
Unit Price

Sales Order Table

Sales OrderID (PK)
CustomerID
Last Name
First Name 
Last Name 
Street Address
Apt
City
State
Zip
Home Phone
Mobile Phone
Other Phone
Order Date
Special Notes 

Sales Order Line Item Table

Sales Order (PK)(FK)
Dount ID (PK)(FK)
Qty

My problem is getting rid of the transitive dependencies in 3NF. What attribute would I use in my fourth table so nothing is redundant or depending on eachother without the primary key? Any direction would be greatly appreciated.


回答1:


The Sales Order table has a transitive dependency on the customer's name and address. If you look closely, you will see that each order will include the full address and name information for a given customer, even though that information probably isn't changing from one order to the next. To remedy this, you can move this information to a new Customer table which would have these fields:

Customer Table

CustomerID (PK)
Last Name
First Name 
Last Name 
Street Address
Apt
City
State
Zip
Home Phone
Mobile Phone
Other Phone

The Sales Order table would then become:

Sales Order Table

Sales OrderID (PK)
Order Date
CustomerID (FK)
Special Notes

Note that the order date can remain in the Sales Order table because conceptually it represents a timestamp when each order occurred, unique to that particular order.



来源:https://stackoverflow.com/questions/39566058/normalization-transitive-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!