dbTalk Databases Forums  

Database design help

comp.databases comp.databases


Discuss Database design help in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
koger
 
Posts: n/a

Default Database design help - 06-02-2007 , 01:20 PM






I'm making a small training program, and I have various exercises such
as:
biking, strength training etc. Some of the fields for these different
activities
will be the same, like heart rate, duration, time, but some will not
such as distance.

Since the exercises are different, my first thought was to make a
table for each exercise, as this seems to be the nicest way to order
things.

Exercise table:
UserID (PK)
ExerciseID (Auto inc)
ExerciseType (enum to bike, aerobic)
Timestamp
Duration
HR (ref to HR table)

Bike table:
ExerciseID (Foreign key)
Distance
MaxSpeed
Route

Aerobic:
ExerciseID (Foreign key)
Program

What I'm not sure about, is the reference to another table from the
exercise table by using the ExerciseType.

I'm new to database design, so this might a good solution, I'm just
not sure about it. So please let me know what you think about the
design.


Reply With Quote
  #2  
Old   
Lennart
 
Posts: n/a

Default Re: Database design help - 06-03-2007 , 06:50 AM






koger wrote:
Quote:
I'm making a small training program, and I have various exercises such
as:
biking, strength training etc. Some of the fields for these different
activities
will be the same, like heart rate, duration, time, but some will not
such as distance.

Since the exercises are different, my first thought was to make a
table for each exercise, as this seems to be the nicest way to order
things.

Exercise table:
UserID (PK)
ExerciseID (Auto inc)
ExerciseType (enum to bike, aerobic)
Timestamp
Duration
HR (ref to HR table)

Bike table:
ExerciseID (Foreign key)
Distance
MaxSpeed
Route

Aerobic:
ExerciseID (Foreign key)
Program

What I'm not sure about, is the reference to another table from the
exercise table by using the ExerciseType.

I'm new to database design, so this might a good solution, I'm just
not sure about it. So please let me know what you think about the
design.

google for "sub super type" in comp.databases, and I think you will find
some examples.

With your design each user can have only one exercise, is that your
intention?


/Lennart


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.