MySQL中的数据库建模 [英] Database modeling in MySQL

查看:66
本文介绍了MySQL中的数据库建模的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一份调查问卷,有70-80个字段需要记录。我只是想把它放到一个数据库中。我想知道我应该创建一个70-80列的单个表并将其分解。或者我可以明智地记录它。有没有任何缺点,热烈欢迎您的反馈。



谢谢

Hi all,

I have a questionnaire with 70-80 fields to record. I just want to put it into a database. I wonder that I should create a single table with 70-80 columns and break it down. Or else I can record it page wise. Is there any drawback on that, your feedback warmly welcome.

Thanks

推荐答案

现在我了解你的问题。



这取决于它是什么类型的问卷。文字答案或复选框。



如果是复选框,我会创建一个包含两列的响应表。 RespondentID和ChoiceID,其中每个响应都在表格中创建一个新行。

带有相应的表格,用于回复者,问题和选择。



如果是文本答案你需要三列:RespondentID,QuestionID和Answer。

此外你还需要相应的答辩人和问题表。


如果你只是将答案存储在数据库中,你不需要打扰页面,但如果是网络问卷,你还需要存储大量的布局数据。
Now I understood your question.

It depends on what kind of questionnaire it is. Text answers or a checkboxes.

If it's checkboxes I'd make a response table having two columns. RespondentID and ChoiceID where every response makes a new line in the table.
With corresponding tables for Respondents, questions and choices.

If it's text answers you'll need three columns: RespondentID, QuestionID and Answer.
Also here you'll need corresponding Respondent and question tables.

If you're just storing the answers in the database you don't need to bother about pages, but if it's a web questionnaire you'll need to store a lot of layout data aswell.


这篇关于MySQL中的数据库建模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆