Designing pricing table (RDBMS agnostic)

data modelingsql

I'm designing a price list table for my database.

It will include Customer, Model, Start_date, End_date, Price, Currency, RRP

When I update a new price list, which is sent every now and then (maybe every 1~3 months), I need to update the prices but I would like to keep the records of what has already been raised.

Currently in system:

Customer  - Model - Start Date - End date  - Price - Currency - RRP
A         - Z     - 2015/10/20 - 2015-12-19- 120   - GBP      - 220
A         - Z     - 2015/12/20 - 2999-12-31- 100   - GBP      - 200

After updating new price:

Customer  - Model - Start Date - End date  - Price - Currency - RRP
A         - Z     - 2015/10/20 - 2015-12-19- 120   - GBP      - 220
A         - Z     - 2015/12/20 - 2016-02-20- 100   - GBP      - 200
A         - Z     - 2016/02/21 - 2999-12-31-  90   - GBP      - 180

What is the best way to update the price?

I tried to google which solved all the problems until now as most of the search results is bringing up SQL price plans 🙁

I have learned MySQL 9 years ago in college for a few months so I know how to interpret the SQL scripts but I am totally lost when I'm trying to create anything from scratch.

Best Answer

I have two comments about your design:

  1. How do you print a whole price list composed of several products? Do you consider all rows with the same customer and same start and end date as being a single price list? Or you just don't have price lists and instead you have separate prices for different products without bundling them into price lists?
  2. You should insert NULL into the end date column instead of a dummy date.

I suggest something like this:

enter image description here

You could have a general price list and special price lists for special clients.

Related Topic