开发者

Adjust prices in dates

开发者 https://www.devze.com 2023-04-13 05:39 出处:网络
I have a main pricelist which is defined something like periodstart periodendprice 2011/01/012011/05/3050

I have a main pricelist which is defined something like

periodstart periodend   price
2011/01/01  2011/05/30  50
2011/06/01  2011/08/31  100
2011/09/01  2011/12/31  50

Now I would like to add the possibility of adjusting prices just for certain dates, 2011/06/15 - 98, 2011/06/16 - 98, 2011/06/23 - 95 etc. Fo开发者_开发技巧r that I planned a new table in order to keep the original pricelist unmodified.

Now I have a doubt should it be more easier to store single dates, or also work with periods

periodstart periodend   price
2011/06/15 - 2011/06/16 98
2011/06/23 - 2011/06/23 95

or

date       price
2011/06/15 98
2011/06/16 98
2011/06/23 95

It would be easier to store and later adjust prices for single dates solution, but on the other hand it would take much more rows to store price change for a continuous range of dates.

I would like to hear different views and ideas for this solution.


the dual date option allows you to have gaps in coverage - and overlaps.

neither are what you want in a single timeline of prices. you could enforce continuity with some business logic, but that is cumbersome.

the single date option is automatically interpreted as a single timeline - but you have slightly more effort to determine bounding dates because you need to look at two records, not one.

this is an easy trade off to me - go with the single date.


Hard to say which is better for you without knowing the distribution of data, but even in the case where you go one record per day, it's still a pretty inconsequential number of records. I mean, in 10 years you'll have 3650 rows. Big deal.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号