Efficient storage of survey answers

5 pts.
Tags:
Database design
SQL Database
We have a website that asks the user a set of questions. The answers are curently stored in SQL database using a table that has: PersonID QuestionID AnswerID Value So one answer to one question is stored in each record. Some questions have more than one possible answers, so all answers to a given question by a person are in 1 or more records. While this design always great flexibility to add questions and answers without changing the table, it can also make some operations a bit challenging, so we are evaluating if this is the best way to do it. Interesting in knowing how others would tackle this.

Answer Wiki

Thanks. We'll let you know when a new response is added.

You might consider looking at the Set datatype: http://dev.mysql.com/tech-resources/articles/mysql-set-datatype.html

The docs warn against using it, though. :-) It sounds like your current method, while a bit more complex, is the approach MySQL would suggest.

**********************************************
I will suggest you to redesign your table structure as below:
Table 1:
Person ID
Question ID

Table 2:
Person ID
QuestionID
AnswerID
ValueID

This will give you more flexibility and better results.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following