为客户提供的商店地址详细信息订单
我正在努力进行数据库设计,用于存储客户地址并将其与库存系统中的订单相关联。目前我有以下架构想法和 3 个选项:
客户
客户ID
客户名称 .....
客户地址
地址ID
客户ID
地址类型(账单、运输等)
地址行1
地址行2 城市
状态
国家 邮政编码
订单(选项 1)
订单ID
客户ID
帐单地址ID
ShippingAddressID
订单(选项 2)
订单ID
客户ID
帐单地址行1
帐单地址行2
比林城
帐单状态
帐单国家/地区
帐单邮政编码
送货地址行1
送货地址行2
发货城市
运输状态
发货国家
ShippingPostCode
订单(选项 3)
订单ID
客户ID
帐单地址Blob
ShippingAddressBlob
我需要订单地址在超时时保持静态。因此,如果我回顾两年前的订单,我可以看到正确地址的商品也已发货并计费。
I am struggling with the database design for storing customer address's and relating them to orders in an inventory system. Currently I have the following schema ideas and 3 options:
Customers
CustomerID
CustomerName .....
CustomerAddress
AddressID
CustomerID
AddressType (Billing, Shipping etc)
AddressLine1
AddressLine2
City
State
Country
PostCode
Orders (Option 1)
OrderID
CustomerID
BillingAddressID
ShippingAddressID
Orders (Option 2)
OrderID
CustomerID
BillingAddressLine1
BillingAddressLine2
BillingCity
BillingState
BillingCountry
BillingPostCode
ShippingAddressLine1
ShippingAddressLine2
ShippingCity
ShippingState
ShippingCountry
ShippingPostCode
Orders (Option 3)
OrderID
CustomerID
BillingAddressBlob
ShippingAddressBlob
I need the address for an order to remain static overtime. So if I look back at an order two years ago I can see the correct address items were shipped too and billed too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自先前的答案以来更新答案对用户没有帮助。
您可以有一个表 OrderAddress 表来保存地址
OrderAddress 表,包含以下列
要将客户链接到地址,您可以拥有一个表 CustomerAddress,其中包含以下列
Isactive 列将用于区分当前是哪个地址积极的。另外,从此表中您可以看到客户存在多少个不同的地址
要查找订单发货的确切地址,您可以检查订单地址表
希望这个解决方案满足您的需求
Updating the answer since previous answer did not help the user.
You can have a table OrderAddress Table to save address
OrderAddress Table with following columns
To link Customer to Address you can have a table CustomerAddress with following columns
Isactive column would be used to differentiate which address is currently active. Also, From this table you can see how many different addresses existed for a customer
To find the exact address where order was shipped you can check OrderAddress Table
Hope this soultions meets your need