Hi. I have a survey form where users can check multiple check boxes per question. This would be simple to build if users can only select one answer per question. My question is what is the best way to design/build this database? Thanks.
8:58 pm on Jul 30, 2010 (gmt 0)
Do you want to: A) match users to questions (i.e., know what answers each user chose for each question), or B) have an anonymous survey (i.e., don't care about tying answers to individual users)?
If A, then the following table (called Answers) would work: UserNumber | QuestionNumber | Answer
You'd probably also need a Users table for tracking: UserNumber | UserName
Create 1 row in the Answers table for each answer. For example, let's say User 1 selects A & C for question 2. Your table would look like: UserNumber | QuestionNumber | Answer 1 | 2 | A 1 | 2 | C
If B, then use the same logic, but drop the UserNumber field and Users table.