Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

smithdp1's avatar

Database Design Help

I am building an app in Laravel 8 that allows access to students. They are given access to certain phases; i.e. Phase 1, Phase 2, Phase3 etc. At the end of each phase they are given a quiz over the material that they studied. That part is all done. Note: quiz scores are not stored.

The following is what I need design/help with. After completing the quiz SOME of the phases will have a questionnaire that they must fill out. All questions are different for each phase and with text answers only (no multiple choice). The answers to these questions are stored in the database and later accessed to autofill pdf forms(got that part figured out). What I am needing help with is the table and relationship design of these tables that store the answers to the phase and also linked to each user. I thought maybe I could make a table for each phase that requires questionnaire with phase_id and user_id but I was wondering if there was a better cleaner way of doing it.

Thanks for any input here!

0 likes
3 replies
smithdp1's avatar

That was nice and clear! So maybe something like this?

Table - phasequestions with columns - phase_id, user_id, timestamps
Table - phaseanswers with columns - phasequestion_id, questionnumber, answer

Not sure about the questionnumber but can't think of a different way to query?

Please or to participate in this conversation.