【发布时间】:2013-03-19 22:57:24
【问题描述】:
您好,我目前正在尝试为项目构建数据库。
目前所有orders 必须有一个customer,customers 有一个address,然后他们有一个shipto address。最多可以添加 10 个不同的shipto addresses。并且每个order 都可以运送到那个customer 中的不同address。
有人知道我应该如何建模吗?
Orders
------
ID
customerID (referencing ID from customers)
other rubbish
Customers
---------
ID
Address
Email
Phone
other rubbish
Shipto
------
ID
CustomerID (referencing ID from customers)
Address
other address related stuff
如何将所有这些联系起来?
*编辑 只是在想,客户应该属于订单吗?还是订单应该属于客户?
【问题讨论】:
-
当您在确定表之间的关系时遇到问题,请用英语(或您的母语)说明关系。客户下订单。客户有零到多个订单。客户有地址。客户有一对多的地址。订单被运送到一个地址。订单和地址具有一对一的关系。现在,去正常化,所以帮助你 Codd。