Adding Data to the tables

Now lets add some data.

Lets add some users: Larry, Curley and Mo.

The SQL scripts for all of this is here.

Its mostly a combination of creative ways to load the table.

Ideally, If I had configuration data, I would just dump the whole table and reload, it, but this is a lot more informative. Just download the scripts and paste them (load them) into your mySql. You should have a pretty rich table.

Here are a few examples

mysql>
mysql> /* Show all exercises and the muscles they work */
mysql> SELECT e.name, mg.muscle_name, emg.primary_muscle
->  FROM exercise e INNER JOIN exercise_muscle_group emg
->    ON e.exercise_id = emg.exercise_id
->    INNER JOIN muscle_group mg
->    ON mg.group_id = emg.group_id
->    ORDER BY e.name;
+-------------------------------+-------------+----------------+
| name                          | muscle_name | primary_muscle |
+-------------------------------+-------------+----------------+
| Barbell Bench Press           | Shoulders   |              0 |
| Barbell Bench Press           | Chest       |              1 |
| Barbell Bench Press           | Triceps     |              0 |
| Barbell Bench Press           | Back        |              0 |
| Barbell Squat                 | Quadriceps  |              1 |
| Barbell Squat                 | Hamstrings  |              0 |
| Barbell Squat                 | Glutes      |              0 |
| Barbell Squat                 | Lower Back  |              0 |
| EZ Bar Bicep Curls            | Biceps      |              1 |
| Leg Extensions                | Quadriceps  |              1 |
| Lying Leg Curls               | Hamstrings  |              1 |
| Seated Barbell Military Press | Shoulders   |              1 |
| Seated Barbell Military Press | Triceps     |              0 |
| Seated Barbell Military Press | traps       |              0 |
| Seated Dumbbell Press         | Shoulders   |              1 |
| Seated Dumbbell Press         | Triceps     |              0 |
| Seated Dumbbell Press         | traps       |              0 |
| Tricep Cable Pushdown         | Shoulders   |              0 |
| Tricep Cable Pushdown         | Chest       |              0 |
| Tricep Cable Pushdown         | Triceps     |              1 |
| Tricep Cable Pushdown         | Back        |              0 |
| Tricep Dumbbell Kickbacks     | Shoulders   |              0 |
| Tricep Dumbbell Kickbacks     | Triceps     |              1 |
+-------------------------------+-------------+----------------+
23 rows in set (0.00 sec)

mysql>
mysql>
mysql> /* list the exercises done by all the members */
mysql> SELECT p.fname, p.lname, w.entry_date, e.name
->  FROM workout w INNER JOIN exercise_record er
->    ON w.workout_id = er.workout_id
->    INNER JOIN exercise e
->    ON er.exercise_id = e.exercise_id
->    INNER JOIN person p
->    on p.person_id = w.person_id;
+-------+--------+------------+---------------------+
| fname | lname  | entry_date | name                |
+-------+--------+------------+---------------------+
| Mo    | Betta  | 2009-01-25 | Barbell Bench Press |
| Mo    | Betta  | 2009-01-25 | Lying Leg Curls     |
| Mo    | Betta  | 2009-01-25 | Leg Extensions      |
| Larry | Stooge | 2009-01-25 | Barbell Bench Press |
| Larry | Stooge | 2009-01-25 | Lying Leg Curls     |
| Larry | Stooge | 2009-01-25 | Leg Extensions      |
| Curly | Que    | 2009-01-25 | Barbell Bench Press |
| Curly | Que    | 2009-01-25 | Lying Leg Curls     |
| Curly | Que    | 2009-01-25 | Leg Extensions      |
+-------+--------+------------+---------------------+
9 rows in set (0.00 sec)

mysql>