Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Database design question

$
0
0
Ok, some background first, I trade goods, I buy 300 of item Y at 120 each. I then sell 200 of Y for 150 each. Now I have 100 of Y left. I then buy more of Y but this time at 130 each.

I need to also track who bought what, how much and the price they payed.

To recap: I'm buying the same items at different prices and quantities, I need to track how much of it I have, and I need to track the sales.

My Initial thought for table design was:
Stock
Stock
StockID,
item type,
item name,
bought price,
bought quantity,
selling price,
isSold, (This is just to mark it so I can leave it out of db queries)


Sales
SaleID,
Customer,
StockID(F-Key),
amount,
isDelivered,



Can someone give me some insight on this, I'm sure there is a way to improve it. If you need more information, please let me know :)/>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>