具有小数据的大型MySQL数据库

时间:2022-12-23 16:54:20

I am designing a database that will be based around a group progress quiz. The quiz consists of 55 questions, and ideally a group of 10 people will take the quiz every few weeks, each person taking it once for everyone in the group, including themselves. So, each time the group takes the quiz, 100 pieces of data will be added to the database.

我正在设计一个基于小组进度测验的数据库。测验由55个问题组成,理想情况下,每10周就会有10人参加测验,每个人都会为团体中的每个人(包括他们自己)进行一次测验。因此,每次小组参加测验时,将向数据库添加100个数据。

Currently my table for storing the quiz answers will have the following rows:

目前,我存储测验答案的表格将包含以下行:

quiz_taker_id      // person taking the quiz
quiz_subject_id    // taker is answering questions about this person
quiz_id            // identifies if this is the 1st time taking the quiz, 2nd time, etc
question1          // answer to question 1
question2          // answer to question 2
...                // etc, for all quiz questions

The quiz answers are incredibly simple, its just a ration of 0-5 on a person's characteristics. Is this a good way to be storing this data? Are there better ways to do this? I am just starting to set up the website and DB, so I want to make sure I am approaching this the right way

测验答案非常简单,只需要一个人的特征0-5。这是存储这些数据的好方法吗?有没有更好的方法来做到这一点?我刚刚开始设置网站和数据库,所以我想确保我以正确的方式接近这个

2 个解决方案

#1


0  

Whenever you want to process data in any way (like make postgame stats) it is a good idea to use databases. Your db design is very simple and lacks some flexibility, like say, you want to add more questions later (now you have to add extra column).

无论何时你想以任何方式处理数据(比如制作postgame stats),最好使用数据库。您的数据库设计非常简单,并且缺乏一些灵活性,比如说,您希望以后添加更多问题(现在您必须添加额外的列)。

So it really depends on what you plan to do with the collected data and if you plan to extend your quiz rules.

因此,这实际上取决于您计划对收集的数据做什么,以及您是否计划扩展测验规则。

#2


0  

This is too long for a comment.

这个评论太长了。

The questions should be in a single table, questions not one table per question. A basic questions table would have each question and its correct answer. This is probably good enough for your problem.

问题应该在一个表中,问题不是每个问题一个表。基本问题表将包含每个问题及其正确答案。这可能足以解决您的问题。

For surveys (and for quizzes, I imagine), there is a versioning problem, because questions can slowly change over time. As a somewhat trivial example, you might start start by asking "What is your gender?" and initially offer two answers "Male", "Female". Over time, you might start adding additional other answers: "Other", "Transsexual", "Hermaphrodite" and so on. When analyzing the answers, you might need to know the version of the question that was asked at a particular time.

对于调查(以及我想象的测验),存在版本问题,因为问题会随着时间的推移而缓慢变化。作为一个有点微不足道的例子,你可以先问“你的性别是什么?”。并且最初提供两个答案“男性”,“女性”。随着时间的推移,您可能会开始添加其他答案:“其他”,“变性人”,“雌雄同体”等。分析答案时,您可能需要知道在特定时间提出的问题的版本。

This is a survey example, where there is no right answer, but a similar idea applies to quizzes: the questions and answers might evolve somewhat over time, but you still want them to be recognized at Question 2, but you want to know the version being asked.

这是一个调查示例,其中没有正确的答案,但类似的想法适用于测验:问题和答案可能会随着时间的推移而有所改变,但您仍然希望它们在问题2中被识别,但您想知道版本被问到。

#1


0  

Whenever you want to process data in any way (like make postgame stats) it is a good idea to use databases. Your db design is very simple and lacks some flexibility, like say, you want to add more questions later (now you have to add extra column).

无论何时你想以任何方式处理数据(比如制作postgame stats),最好使用数据库。您的数据库设计非常简单,并且缺乏一些灵活性,比如说,您希望以后添加更多问题(现在您必须添加额外的列)。

So it really depends on what you plan to do with the collected data and if you plan to extend your quiz rules.

因此,这实际上取决于您计划对收集的数据做什么,以及您是否计划扩展测验规则。

#2


0  

This is too long for a comment.

这个评论太长了。

The questions should be in a single table, questions not one table per question. A basic questions table would have each question and its correct answer. This is probably good enough for your problem.

问题应该在一个表中,问题不是每个问题一个表。基本问题表将包含每个问题及其正确答案。这可能足以解决您的问题。

For surveys (and for quizzes, I imagine), there is a versioning problem, because questions can slowly change over time. As a somewhat trivial example, you might start start by asking "What is your gender?" and initially offer two answers "Male", "Female". Over time, you might start adding additional other answers: "Other", "Transsexual", "Hermaphrodite" and so on. When analyzing the answers, you might need to know the version of the question that was asked at a particular time.

对于调查(以及我想象的测验),存在版本问题,因为问题会随着时间的推移而缓慢变化。作为一个有点微不足道的例子,你可以先问“你的性别是什么?”。并且最初提供两个答案“男性”,“女性”。随着时间的推移,您可能会开始添加其他答案:“其他”,“变性人”,“雌雄同体”等。分析答案时,您可能需要知道在特定时间提出的问题的版本。

This is a survey example, where there is no right answer, but a similar idea applies to quizzes: the questions and answers might evolve somewhat over time, but you still want them to be recognized at Question 2, but you want to know the version being asked.

这是一个调查示例,其中没有正确的答案,但类似的想法适用于测验:问题和答案可能会随着时间的推移而有所改变,但您仍然希望它们在问题2中被识别,但您想知道版本被问到。