开发者

How to design a complex questionnarie database

Der experts

I am trying to model a complex questionnaire following this database model:

http://www.databaseanswers.org/data_models/questionnaires_complex/ind开发者_如何学编程ex.htm

I am having a little bit of difficulty understanding the model.

Let us say that i have a question which takes a Ranked Answer from 1-5

[Table]
Question_types
type_code = 1
type_description = "Ranked Answer"

[Table]
Questions
question_number = 1
question_type = 1
question_wording = "How much do you like lasagne?"

I want the question ranked from 1-5 - in which table should i put the possible rankings?

Thanks in advance Nanek


Isn't a ranked question just a specific type of multiple choice question? So your rankings have to be put into the table "Multiple_Choice_Questions", with "choice number" receiving your 1 to 5 and "choice wording" your rank-specific text (like "worst" to "best").


Something like this, I suppose?

[Table]
Ranked_Answers

question_number = 1
answer_rank = 1
answer_wording = "Love"

question_number = 1
answer_rank = 2
answer_wording = "Like"

question_number = 1
answer_rank = 3
answer_wording = "Indifferent"

question_number = 1
answer_rank = 4
answer_wording = "Dislike"

question_number = 1
answer_rank = 5
answer_wording = "Hate"

And thus question_number would be a foreign key here, assuming it's the primary key in your Questions table.


Is there a reason that you don't just save the value from the code? IE. have a radio button set in HTML with different values, and then store the value selected by the user?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜