Results 1 to 2 of 2

Thread: Design Question

  1. #1
    Join Date
    Jul 2009

    Question Unanswered: Design Question

    Hello all,

    It's been quite some time since I've posted to these forums. I'm currently involved in a rather robust database project, and can't quite get my head around how to structure it.

    Basically, I have a single table of users. Each day, each user will supply a single value. I want the database to be able to then track these values over any period of time among any subset of users. So, it can look at all users over the past year, or one user over the past week... that sort of thing.

    I don't know how to store these daily values. Any ideas?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by Greelmo View Post
    I don't know how to store these daily values. Any ideas?
    CREATE TABLE dailyvalues
    ( userid INTEGER NOT NULL 
    , FOREIGN KEY ( userid ) REFERENCES users ( id )
    , thedate DATE NOT NULL
    , thevalue INTEGER NOT NULL
    , PRIMARY KEY ( userid,thedate )
    ); | @rudydotca
    Buy my SitePoint book: Simply SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts