1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Database Design Question

Discussion in 'Programming' started by kuepper, Feb 8, 2007.

  1. #1
    I have a database design question that i'm trying to think through. If I have a stock portfolio application, what would the database look like? I know I'd have the following:

    Transaction Table
    - transid
    - stocksymbol
    - stockprice
    - transactiondate
    - numberofshares
    - ownerid (fk)
    - transactiontype (buy or sell)

    Owner Table
    - ownerid
    - email
    - password

    Put how would I query the transactions to bring up a portfolio of stocks they own? Or would I have to create a new portfolio table? And if so, what would the fields in that table be and how would it work?

    Thanks for any help in advance!
     
    kuepper, Feb 8, 2007 IP
  2. TasteOfPower

    TasteOfPower Peon

    Messages:
    572
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    stock lookup table
    user table
    user portfolio table
    transaction table

    select * from userportfolio where userid = <id of user>
    Code (markup):
    to get a list of a users stocks
     
    TasteOfPower, Feb 8, 2007 IP
    kuepper likes this.