需要帮助将表格标准化到3NF



我想规范化表到目前为止,我已经这样做了:

这是我的3Nf吗?

Order(orderNo,orderDate,customerId)
Customer(customerId,customerName,customerCurrentAddress,customerPermanentAddress)
Product(productId,productName,Qty,categoryId)
Category(categoryId,categoryName)
Sub-Category(subCatId,subCatName,categoryId)

此处给定的表格:https://drive.google.com/file/d/1F7cQjjxz9rnY6RHaGtZXuwVGFEHBVgNo/view

为了跟踪包含多个产品的订单,您必须在订单和产品之间创建一个连接表。

Order(orderNo,orderDate,customerId)
Order_Details(orderNo,productId,Qty)
Customer(customerId,customerName,customerCurrentAddress,customerPermanentAddress)
Product(productId,productName,Qty,categoryId)
Category(categoryId,categoryName)
Sub-Category(subCatId,subCatName,categoryId)

基于Wiki中的定义:如果表在1NF中,则表在2NF中,并且没有非素数属性依赖于表的任何候选键的任何适当子集。您的大多数表只有2列,因此它们满足了这一要求。对于Customer(customerId,customerName,customerCurrentAddress,customerPermanentAddress),候选密钥是customerId,而其他列完全依赖于整个候选密钥,则可以。

对于3NF,Wiki说:表中的所有属性都只由该表的候选键决定,而不是由任何非素数属性决定。正如你所看到的,你们的桌子都很满意。

最新更新