我想规范化表格到目前为止,我已经做到了:
我的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说:表中的所有属性仅由该表的候选键确定,而不由任何非素数属性确定。如您所见,您的餐桌都很满意。