Jump to content
Sign in to follow this  
El_Pablo

The price of a product in time

Recommended Posts

Hi,

How would you model the structure of the tables to know what was the price of a product in time? In a billing system it's important to keep the price up to date and also keep the price paid for a product for a specific time.

This is one of my approach

products (pkProductID, price (lookup from prices), ...)

prices (pkPriceID, fkProductIDprice, date, ...)

billDetail (fkProductID, fkBillID, price (lookup from product), ...)

Thanx for any other suggestion.

Share this post


Link to post
Share on other sites

The price in Products is redundant. The line item (billDetail) can lookup directly from Prices, based on ProductID and either the date or just the most recent price (depending on whether you have future prices and/or bill retroactively).

Share this post


Link to post
Share on other sites

No, not at all - just sort the relationship by date (or by PriceID), descending.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    spand 
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.