database model for products and product package with different combinations

我只是一个虾纸丫 提交于 2019-12-04 12:08:58
Neil McGuigan

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.

I was hoping for some input regarding this but maybe the question is to "messy" to answer. :o)

My model right now is like this:

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

ProductPkgTbl

ppkg_id   prod_id      prod_name 
1         1            prepaid-A 
1         5            mms       
1         4            internet  

2         4            internet  
2         6            email     

3         3            prepaid-C 
3         4            internet  
3         5            mms       
3         6            email     

ProductPkgFeeTbl

ppkg_id   ppkig_fee
1         25
2         10
3         45

But there are some flaws in above, and it is that someone could insert same products in different pkg and with different fees.

I really can't figure out how to be sure that a pkg is unique, with sql. Well, of course a programming language / stored procedure / triggers etc can make the check ! But I want to have a design that is 100% flawless.

Please push me in the right direction with your experience in matters like this...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!