-2

I'm struggling to find how to correctly design a database in order to store and retrieve data for my software. Basically, I'm designing an application for a gym (C++, MySQL with PhpMyAdmin):

  1. each user (unique ID, name, surname) can have one or more training routines
  2. a training routine is divided in training schedules (from A to E)
  3. each training schedule contains a series of exercises (name, set, reps) divided in muscolar groups (i.e. CHEST, SHOULDER, BICEPS and so on).

The training routines can be created or retrieved from the database by looking if they are associated to a specific user; the combination of exercies is not unique and can be shared from one or more users.

For example:

 -- Start of training routine #1 -- EXERCISES SET REP Training schedule A - CHEST Wide chest hammer 4 10 Incline press hammer 3 15 Pek Fly 4 10 - BICEPS Scott Machine 4 10 Curls 4 12 - LEGS Calf press 4 16 Training schedule B - SHOULDER Should press hammer 3 10 Reverse pek fly 3 10 Push Press 3 10 - QUADRICEPS Leg Curls 4 10 Leg Press 5 12 Training schedule C .. so on.. -- End of Training routine #1 -- 

I though to create a table for the users, then a table for each training routine with a unique ID where I will store the schedules (A,B,C..) associated with the same ID if they are included in the same training routine; then to create a muscolar group table where I store the exercises. But I do not know if this is the correct solution because I still have to handle the SET and REPs.

What do you suggest? May be the training routine table is redundant because I can retrieve the same information by looking at all the schedules which report the same ID.

Should I use a single table to store the whole training routine or it would be better to use multiple tables?

2
  • For your "Wide chest hammer" exercise, what determines that the Sets/Reps are 4/10? Is it the fact that its in "Training schedule A" or is it because its in "Training routine #1"?
    – GHP
    CommentedApr 28, 2020 at 21:19
  • set and reps are just integer values which can change depending on the multiple parameters. They are inserted manually when the training routine is created by the trainer.CommentedApr 28, 2020 at 22:39

1 Answer 1

1

I'd go with something basic like this:

Trainer trainerId (pkey) TrainingRoutine trainingRoutineId (pkey) trainerId (fkey -> Trainer(trainerId)) trainingRoutineName TrainingSchedule trainingScheduleId (pkey) trainingRoutineId (fkey -> TrainingRoutine(trainingRoutineId)) trainingScheduleName ('A' || 'B' || etc) SpecificExerciseOnSchedule id (pkey) exerciseId (fkey -> Exercise(exerciseId)) trainingScheduleId (fkey -> TrainingSchedule(trainingScheduleId)) sets (int) reps (int) Exercise exerciseId (pkey) exerciseName exerciseGroupName ('shoulder' || 'quadriceps' || etc) 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.