The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How do I represent this data?! Reply To: How do I represent this data?!


Maybe I should elaborate my situation. I’ll provide a more thorough example and essentially I need help figuring out the best structure to represent in a relational database like MySQL.

The user will first be asked a set of questions with the following possible answers : Q1: How old are you? a)0-18 b)18-25 c)25-55 d)55+

Q2: Do you smoke? a) Yes b) No

If the user selects option A for the first one and option A for the 2nd one the user may be asked a set of questions based on that response. If they chose any other combination they may get another SET of questions.

The issues I’m facing are,
How do I represent a SET of questions and their answers?

How do I represent the fact that for a given set, choosing option A for Q1 and option B for Q2 leads to set 3, whereas choosing option B for Q1 and option C for Q2 lead to set 4

I will never have to go backwards, but I may be able to add more questions to a set that could lead to other sets.