0

I am new to database design and I am using php and laravel in particular with mysql as my db layer.

I want to allow people to create and save training programs. each program can have multiple weeks, each week has 7 days, each day can have many training sessions, each session has 3 phases and each phase has many excersises.

I have a table of excersises already and I initially thought that I should just build an array of the data and store that array, unfortunately mysql does not support arrays so it would have to be stored as a string in the programs table. Now i am thinking that maybe a table for each object(weeks, days, session) that are all related in some way to the programs table might be a better way to go.

in the near future I would like for people to be able to mark each excersise /session /day / week as completed so which solution might make that easier?

If the array is the best option should I switch to postgres from mysql for their array functionality or is saving it as a string accepted practice?

Thanks

2 Answers 2

2

In my view it is good to use multiple tables instead of storing array as a string.

  • think of your needs
  • Plan your database design in such a way that in future if you want to add some table or columns in your table you face no difficulties. also i advice you to normalize your database. here are some good links on normalization of database. Normalization of database,Four ways to normalize your database
Sign up to request clarification or add additional context in comments.

Comments

1

It is good practise to use different tables for each one like weeks, days, sessions, phases, exercises.As per your needs you can consider another option like Mongo DB.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.