Database for survey
Posted
by
zfm
on Programmers
See other posts from Programmers
or by zfm
Published on 2012-07-01T00:22:04Z
Indexed on
2012/07/01
3:23 UTC
Read the original article
Hit count: 291
database-design
|Survey
One of my job now is to design a database for a survey. Let's say we have a series of questions (web-based), in which one page contains one question. Not every person will be given the same questions, those are based on their previous answers and also randomness.
I would like to know whether it is better to have database like this
user question answer
userX question1 answer1A
userX question2 answer2C
userX question5 answer5F
userY question1 answer1B
userY question3 answer3B
userY question6 answer6D
...
or
user q1 q2 q3 q4 q5 q6
userX 1A 2C null null 5F null
userY 1B null 3B null null 6D
...
My idea here is, using the second approach seems better, however I would like to know whether updating the table is (much) slower than inserting a new row? Also with the first approach, I can omit having some null answers.
The total questions given are fix, the client wont add any more question later on.
So my question is, what will you do if you were me?
© Programmers or respective owner