garywood84
Registered User.
- Local time
- Today, 14:32
- Joined
- Apr 12, 2006
- Messages
- 168
I am building a database to manage stock items and track orders. It needs to keep track of sales and the number of items currently available for sale.
I looked at the Northwind (2007) sample, and it seems that it calculates the number of items in stock using a query that sums the quantity sold, the quantity purchased, and then deducts one from the other to calculate the number available for sale.
I could make my database work like this. However, I can't believe this is the most efficient way to do it - doesn't it mean there's a relatively high processing requirement each time somebody wants to view stock availability (and that this will increase, the longer the database is used for)?
I wonder if it would be better to have a table that lists current stock levels, and when stock is purchased add the quantity to the available stock value for each item, and have a similar deduction from available stock when items are sold.
The problem is, that whilst I think this latter option would be more efficient, I don't know how I'd do it!
Please can someone help me to:
1) Decide if my thinking is correct and my way more efficient?
2) If my way is more efficient, get started with implementing it?
Thanks,
Gary
I looked at the Northwind (2007) sample, and it seems that it calculates the number of items in stock using a query that sums the quantity sold, the quantity purchased, and then deducts one from the other to calculate the number available for sale.
I could make my database work like this. However, I can't believe this is the most efficient way to do it - doesn't it mean there's a relatively high processing requirement each time somebody wants to view stock availability (and that this will increase, the longer the database is used for)?
I wonder if it would be better to have a table that lists current stock levels, and when stock is purchased add the quantity to the available stock value for each item, and have a similar deduction from available stock when items are sold.
The problem is, that whilst I think this latter option would be more efficient, I don't know how I'd do it!
Please can someone help me to:
1) Decide if my thinking is correct and my way more efficient?
2) If my way is more efficient, get started with implementing it?
Thanks,
Gary