如何管理数据库中的商品价格 [英] How to manage item price in data base

查看:309
本文介绍了如何管理数据库中的商品价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have two table in my application, one is "item" and "itemprice" and these are already created by a previous developer. The itemprice table contain fields like, unitOfSale , itemPoint, itemSalePrice and itemPurchasePrice, tax. There are some fields those are duplicate in item and itmPrice table.

Can i merge itemPrice table in item table. will it do any negative imapact on architecture,

Do I need to keep the history of itemprice when it changes?

If I need to keep history of price then which architecture should i follow ? one table (merged table) or two table?





我尝试过:



我没有再尝试过它,因为它具体条件



What I have tried:

I did not tried it any more as it specific condition

推荐答案

我建​​议有两个表这样价格可以改变:如果一件商品周一以10英镑的价格购买,并在周四价格上涨至15英镑后退回,则需要退还适当的金额。

有两种方式处理:一个是保持收据/发票项目行数据的价格,另一个是为项目价格的每个变化维护一个单独的表项。

从快速查看表格,我会说收据/发票数据是您的第二个表格,但您必须检查表格的其余部分以及操作它的代码当然 - 我们无法为您做到这一点,我们无法访问它。但如果是,那么我强烈建议你保持原样!
I'd suggest that there are two tables so that the price can change: if an item is bought on Monday at £10, and returned on Thursday after the price rose to £15, you want to refund the right amount of money.
There are two ways to handle that: one is to keep the price charged with the receipt / invoice item line data, and the other is to maintain a separate table entry for each change in item price.
From a quick look at your table, I'd say that the receipt / invoice data is your second table but you'd have to inspect the rest of the table and the code that manipulates it to be sure - we can't do that for you, we don't have any access to it. But if it is, then I'd strongly recommend you leave it as is!


这篇关于如何管理数据库中的商品价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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