Questionnaire database and preorder traversal tree alogorithm

HI all

I need to create a questionnaire dataabse.My questionnaire is dynamic.It’s having yes/no type questions.I need to implement the databse tables based on the ‘yes/no’

Which is the best method?

Can I use modified pre order traversal algorithm for this scenario?

please give me your suggestions ?

Thanks to all

i don’t see how or why your questions would be arranged hierarchically

If it is known that the questions will always be yes/no than its just a standard 1:m relationship.


  • id (pk)


  • id (pk)
  • questionnaire_id (fk)
  • question


  • questionnaire_question_id (fk)
  • user_id (reference to user)
  • yes (0 or 1 value stored as TINYINT)

for example