Database design for a particular sales order scenario


Please refer to the database design below:

enter image description here

Consider a scenario where a sales order is created based on the prodcuts in the 'Product' table. But if the price of any product changes, then the price should not be updated in any sales orders created in the past. That price should only be used for new sales orders. What do I need to do to take care of this kinda situation?


Answers:


You need to add Cost and Price to the SalesOrderProduct table, and set them during the initial append of that table.