php - Database structure for stock trading website? -
i have created simple stock trading simulation website. users can sign , buy/sell stocks. now, i've come problem. when use buys stock (can more 1 share), how put database?
this bit of challenge because each user can buy stock exists , can buy quantity.
here's example of i'm trying store db:
stocks owned username1261817
symbol: quantity
goog: 3
yhoo: 8
aapl: 3
etc...
you might have design table how shopping cart do. include fields - userid (comes user table), stock symbol, quantity, stock price @ time of purchase, date purchased. generate necessary reports total stocks of 1 type, total stocks owned user etc.
Comments
Post a Comment