调查问卷的MySQL表设计

时间:2022-05-02 12:58:26

I am fairly new to MySQL and have a project in which I need to design a database that will store responses from an online questionnaire. Reports will need to be written from the data. Does anyone have any tips on what type of fields to use? The questions will either have a Yes No answer, a choice of 4 options from very satisfied to very dis-satisfied or multipul choice. It's mainly the choice questions that I'm unsure on, as I will need to be able to product a report to show the percentage of satisfied customers. I know it's probably really basic, but I don't want to get it wrong.

我是MySQL的新手,我有一个项目,我需要设计一个数据库来存储在线调查问卷的答案。需要从数据中写入报告。有没有人有什么类型的字段使用的提示?问题要么是“否”答案,要么选择从非常满意到非常不满意或多种选择的4个选项。这主要是我不确定的选择问题,因为我需要能够生成一份报告来显示满意客户的百分比。我知道这可能是非常基本的,但我不想错。

2 个解决方案

#1


1  

Some of this depends on the design of the survey - is it single or multi-page; if multi-page, are you storing the data as the user moves from page to page, or just at the end, etc. I think the biggest issue is whether a single survey response is going to correspond to a single database row or whether a single survey response may be split across multiple rows. Obviously the former is the way to go if at all possible.

其中一些取决于调查的设计 - 是单页还是多页;如果是多页,您是在用户从一个页面移动到另一个页面时存储数据,还是只是在最后等等,我认为最大的问题是单个调查响应是对应于单个数据库行还是一个单个调查响应可以分为多行。显然,如果可能的话,前者是可行的方式。

For the multi-choice questions specifically, I would use either INT or ENUM columns; determining the fraction of respondants answering in a particular way is a simple "SELECT ... GROUP BY " query.

对于具体的多项选择题,我会使用INT或ENUM列;确定以特定方式回答的响应者的比例是一个简单的“SELECT ... GROUP BY”查询。

#2


1  

Have you explored the option of using something like SurveyMonkey for your questionnaire?

您是否已探索过使用SurveyMonkey等问题进行调查的选项?

If that doesn't suit, there's a thread on MySQL's forum which may help: Database design for multiple choice questionnaire results?

如果这不适合,那么在MySQL的论坛上有一个主题可能会有所帮助:数据库设计可以选择多项问卷调查结果吗?

#1


1  

Some of this depends on the design of the survey - is it single or multi-page; if multi-page, are you storing the data as the user moves from page to page, or just at the end, etc. I think the biggest issue is whether a single survey response is going to correspond to a single database row or whether a single survey response may be split across multiple rows. Obviously the former is the way to go if at all possible.

其中一些取决于调查的设计 - 是单页还是多页;如果是多页,您是在用户从一个页面移动到另一个页面时存储数据,还是只是在最后等等,我认为最大的问题是单个调查响应是对应于单个数据库行还是一个单个调查响应可以分为多行。显然,如果可能的话,前者是可行的方式。

For the multi-choice questions specifically, I would use either INT or ENUM columns; determining the fraction of respondants answering in a particular way is a simple "SELECT ... GROUP BY " query.

对于具体的多项选择题,我会使用INT或ENUM列;确定以特定方式回答的响应者的比例是一个简单的“SELECT ... GROUP BY”查询。

#2


1  

Have you explored the option of using something like SurveyMonkey for your questionnaire?

您是否已探索过使用SurveyMonkey等问题进行调查的选项?

If that doesn't suit, there's a thread on MySQL's forum which may help: Database design for multiple choice questionnaire results?

如果这不适合,那么在MySQL的论坛上有一个主题可能会有所帮助:数据库设计可以选择多项问卷调查结果吗?