SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    May 2003
    Location
    somewhere on the Earth
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    db normalization: difficult handling stock and inventory

    yes i know it's no good storing calculation data in db
    but think about the stocks
    they are results of selling and purchasing and so they are calculated data then it should not be stored in db. if so , every time when inventorying is needed, re-calculation of all the sales and purchases has to be done. for a small business, this might not be a problem , is it? so i decided to do so.

    what about your idea? is there any better solution?

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    It depends on how one tracks inventory. If one tracks unique items then one should not store a calculated inventory. Pretty easy to do, just add items as they come in and flag status as appropriate. Calculating is easy, and not particularly resource intensive if indicies are proprely configured.

    OTOH, if one just keeps a list of items offered and number in stock, then just add or subtract as necessary. Just be careful to lock the appropriate tables to avoid users purchasing items some one else is purchasing.

    WWB


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •