User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,528 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser:

Quantity Per Unit value is not unique.

Join Date: Apr 2008
Posts: 275
Reputation: tesuji is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 37
tesuji tesuji is offline Offline
Posting Whiz in Training

Re: Quantity Per Unit value is not unique.

  #2  
Apr 19th, 2008
hi mezo,

It depends on your datamodel where to store changing data. As for example merchandise management systems (also retail systems, ERP) usually distinguish between master data which remain almost unchangeable and transaction data which differs, for example such things like customers order data. If your customers can order a product in different quantities, say 5, 6, or 7 pieces / unit this information should be stored in an extra table, e.g. customers order item table together with item number, total price etc.

On the other hand you usually need a further table (and much more in real world applications) where you keep book which qty/unit can be assigned to a certain product, maybe also data to get total price.

So your core tables could look like these three:
masterdata(ItemNb#, Itemname),
Customerorderitems(orderNb#, ItemNb#, quantity, qty_per_unit, total_price),
productunits(ItemNb#, qty_per_unit#, price). (where # denotes primary key columns).

Maybe I can give you more help, if you show more details of your data model.

btw, it isn't a good idea to add three columns to your product table for recording the given three qty / unit because there would arise some serious problems when trying to create useful SQL queries or also when doing normalization.

krs,
cliff
Reply With Quote  
All times are GMT -4. The time now is 6:38 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC