Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Design confusion

    Hey guys, I'm making a website and I have an option to define your availability throughout the week, however I need a database table to store this information, I have been thinking long and hard about how I might do this and I can't come to a decision (or convince myself its the easiest way!)

    Basically, for each day, monday through sunday, a user can set if they are available, at earliest time, until latest time, and then three locations at which they may be available.

    I have it figured that I will need these columns at least:

    Available (Bool)
    From (Time)
    Until (Time)
    Location 1 (Varchar)
    Location 2 (Varchar)
    Location 3 (Varchar)

    now how do I link this to both the user AND the day.. DO i add a column foreign key for UserID from my user table and then make 7 seperate tables, one for each day of the week or do I have one table with 6 columns*7(days of the week) plus user id... I have no idea what the best way to do this is or if I am missing something,I am relatively new to this. Thanks!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    I'd add a user identifier and a day identifier to your existing table.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

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
  •