数据库模型的产品和产品包装有不同的组合 [英] database model for products and product package with different combinations

查看:193
本文介绍了数据库模型的产品和产品包装有不同的组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何设计数据库以实现此功能?



考虑一个场景,我们要创建一个 >产品关系(包) ...



说,我们创建一个 ProductTbl

  prod_id prod_name prod_fee 
1 prepaid-A 19 usd
2 prepaid-B 29 usd
3 prepaid-C 39 usd
4互联网9 usd
5 mms 1 usd
6电子邮件3 usd

我们想提供一个为客户提供更好的费用的产品包。


例如如果客户选择预付-A +互联网+ mms ,他们将以25 usd(而不是29 usd)的pkg费用。


设计




  • 具有相同组合的pkg应该只存在一次。
  • 如果可能,pkg可以拥有无​​限数量的产品。 (通常是2-4)。



例如。的pkg组合



ProdPkgTbl

  ppkg_id prod_name prod_fee 
1 prepaid-A 25 usd
1 mms 25 usd
1 internet 25 usd

2互联网10 usd
2电子邮件10 usd

3 prepaid-C 45 usd
3 internet 45 usd
3 mms 45 usd
3电子邮件45 usd
/ pre>

这意味着组合



  • pkgid 1 - >预付a,mms和互联网,收取25美元的pkg费用

  • pkgid 2 - >互联网和电子邮件一起收取10美元的费用

  • pkgid 3 - > prepaid-c,internet,mms,email all together for 45 usd


所以如果一个客户得到了 prepaid-c + internet ,只有他们没有得到45 usd的交易,他们将支付正常费用39 + 9 = 48 usd 。



现在这个表仅仅是为了演示,我希望得到你的意见和建议,以正确的方向建模。



我们需要首先选择 - 查询客户目前的费用计划(基于二手产品/服务),然后查看产品pkg,看看pkg交易是否对他们有效。



(如何做这样的选择?在pkg表?)
如何有一个好的数据库模型?



请提供url,提示,任何有价值的东西推动我的权利方向



非常感谢。

解决方案

目录中的服务。您也可以出售上述的组合。这被称为营销包(或捆绑包或组合)。



营销包也从目录中销售。它可以由商品,服务或其他营销包组成。



每个订单的价格真的不同。您可以在表中设置基准价格,服务表中的每月价格以及营销包表中的基准价格。




How would you design your database to achieve this functionality?

Consider a scenario where we want to create a product relation (package)...

Say that we create a ProductTbl

prod_id   prod_name    prod_fee
1         prepaid-A    19 usd
2         prepaid-B    29 usd
3         prepaid-C    39 usd
4         internet      9 usd
5         mms           1 usd
6         email         3 usd

We want to offer a product package that provides better fees for customer.

E.g. if customer choose prepaid-A + internet + mms they will have a pkg fee by 25 usd (instead of 29 usd).

DESIGN

  • A pkg with same combination should only exist once.
  • A pkg can have unlimited number of products, if possible. (Normally will be 2-4).

E.g. of a pkg combination

ProdPkgTbl

ppkg_id   prod_name    prod_fee
1         prepaid-A    25 usd
1         mms          25 usd
1         internet     25 usd

2         internet     10 usd
2         email        10 usd

3         prepaid-C    45 usd
3         internet     45 usd
3         mms          45 usd
3         email        45 usd

This means that combination

  • pkgid 1 -> prepaid-a, mms, and internet for a pkg fee of 25 usd
  • pkgid 2 -> internet and email together for a fee of 10 usd
  • pkgid 3 -> prepaid-c, internet, mms, email all together for 45 usd

So if a customer got prepaid-c + internet only they not get the deal for 45 usd, they will pay normal fee of 39 + 9 = 48 usd.

NOW THIS TABLES are just for demo, I would like to get your input and advice to model it in a right direction.

We will need first to select-query a customer current fee plan (based on used products/services) and after that look into the product pkg and see if pkg deal is valid for them or not.

(How to do such selection? on pkg table?) How to have a good db model for this?

Please advice with urls, hints, anything with value to push me into the right direction.

Great thanks.

解决方案

You are selling goods or services from a catalog. You can also sell combinations of the above. This is called a Marketing Package (or Bundle or Combo).

A marketing package is also sold from the catalog. It can be comprised of goods, services, or other marketing packages.

The price is really different per order. You could set a base price in the good table, a monthly price in the service table, and a base price in the marketing package table.

这篇关于数据库模型的产品和产品包装有不同的组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆