Thursday, November 1, 2018

Open-question survey database design

Recently, my friends discussed with me for how to design a database for online Survey system.
First of all, we found that there are plenty of types of survey. 

To simplify it, we focus on the open question on this moment(no predefined options for answer, no conditional question order).




On this design,

1. We can define tons of questions and then user Survey_Question table to pick up suitable questions to the specific Survey.

2. Using Survay_Participant table, we can get all the participants through the survey Id.

3. On Answer table, because of the FK SurveyParticipantId, we can know this answer is made by which participant and for which survey. Also, this table is bound to the question that it answered for.

4. Note that, we only store answer text in Answer table because it is open question.