Forum Moderators: open

Message Too Old, No Replies

advice with database structure

structure

         

malcolmcroucher

2:09 pm on Aug 29, 2008 (gmt 0)

10+ Year Member



okay i need advice with some structuring issues im having:

im trying to do a schedule for a bunch of activities.

so for instance you can do an activity on monday at 9 until 12.

so i have :

Schedule-id
activity-id
activity-day
activity-start
activity-end

my problem is i end up with multiple schedules-id's

which dont correspond with my primary key activity-id ?

Do you understand ?

unless i have
activity-id - 100
schedule-id - monday
schedule-id - tuesday
schedule-id - wednesday
schedule-id - thursday
schedule-id - friday
schedule-id - saturday

does that seem right ?

coopster

5:12 pm on Aug 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



So there is a 1-to-1 relationship between schedule-activity, but there can be multiple occurrences of the activity for any given day/time/location? How about making the PRIMARY KEY a compound key? I hope I understand what you are asking. Have a look at the second example on this page regarding Using AUTO_INCREMENT [dev.mysql.com] with the grouped key to see if it applies.