In the northwind traders database unitprice is listed on both the products and [order details] tables. Both tables list different prices for the same product. Is this a redundancy or is there an explanation for this?
+7
A:
There's a reason.
When you change the price of a product, you don't want all orders containing that product changing as well. You need the unitprice in the [Order Details] table to preserve history.
Arjan Einbu
2009-07-09 12:03:56
Correct. Think of it this way - the "UnitPrice" in the Order Details table is the unit price that the person actually paid - the price that was in effect at the time the order occurred. It's historical information.
GalacticCowboy
2009-07-09 12:20:26
Didn't think of that. thanks.
Phil
2009-07-09 12:33:06