database 在线商店的数据库架构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35612778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Database schema for an online shop
提问by Left4Cookies
So I'm fiddling with how you could design the basic db schema for a webshop. Sure, there's a lot of missing details here and there, but I just want to get the most basic stuff right.
所以我在摆弄如何为网上商店设计基本的数据库模式。当然,这里和那里有很多细节缺失,但我只想把最基本的东西弄对。
Some basic requirements for the shop, which I'm trying to make a schema of:
商店的一些基本要求,我正在尝试制作一个架构:
The shop has an inventory of products. Each product has a price, but this price should vary depending on sales. Customers can make orders for multiple products at a time, and should be able to see their order history. When the order has been completed, there should be a track and trace number.
这家商店有产品库存。每个产品都有一个价格,但这个价格应该根据销售情况而有所不同。客户可以一次订购多种产品,并且应该能够看到他们的订单历史记录。订单完成后,应有跟踪编号。
So, the following image is what I've come up with so far. I'm sure something is missing, I'm just not really sure what, also how to model the dynamic price aspect.
所以,下图是我到目前为止所想出的。我确定缺少某些东西,我只是不确定是什么,以及如何对动态价格方面进行建模。
采纳答案by qwerty_so
A common way to handle variable price would be to introduce a rebate schema. This can be implemented as association class between Product
and Sale
by adding some rebate to amountSold. Of course there are many different ways, but this is one at hand.
处理可变价格的常用方法是引入折扣模式。这可以实现之间的关联类Product
,并Sale
添加一些回扣amountSold。当然有很多不同的方法,但这是手头的一种。
- I'm missing a relation between
Order
andCustomer
. - Not sure what you intend with the
Inventory
aggregatingProductList
. To me aInventory
listsProduct
. There might be the need to a store location and aPurchasePipe
- 我缺少
Order
和之间的关系Customer
。 - 不确定您对
Inventory
聚合ProductList
. 给我一个Inventory
清单Product
。可能需要一个商店位置和一个PurchasePipe