您是否可以为测验问题和答案推荐一个数据库设计,以允许大量的问题类型? [英] Can you recommend a database design for quiz questions and answers that would allow for an extensible number of question types?

查看:69
本文介绍了您是否可以为测验问题和答案推荐一个数据库设计,以允许大量的问题类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止的示例问题类型:




  • 单选题(单选按钮)


  • 多选多重答案(请考虑复选框)


  • 匹配(现在有很多可能的选择组合)




我想将它们存储在数据库结构中,将来可用于这些问题以及更多类型的问题,所以我正在尝试一种使其可扩展的方法。



现在我有了(但是您的建议不必受此限制) :




  • 问题表

  • 答案表

  • ChosenAnswers table

  • 用户表



一个问题可以有多个答案。
一个用户/问题对可以有很多ChosenAnswers。



但是,据我所知,我无法通过Matching很好地完成这项工作, m也不是100%相信它会很容易地用于多重答案,很容易意味着在计算人的总得分等时所需的逻辑最少。



有人可以认为一种设计使我可以使用所有这三种类型的测验问题以及将来添加的测验?我需要一些启发,如果您愿意的话,可以进行范式转换。



未来问题类型的一个示例可能是按适当的顺序排列这些事物列表。 ..等等。



必须有一种方法,不管看起来多么复杂,在考虑所有这些可能的问题类型的同时仍然让我使用



请在此处的评论中告知我是否缺少我的详细信息,但是最好假设我甚至没有考虑过您正在考虑的细节,因为我已经把所有问题都放在了问题中,但是我会根据要求添加清楚性。

解决方案

在下面的设计中,我们将在问题表中使用一系列标志来指示问题的类型。我们还指出了问题的级别。答案表通过外键链接到问题表。完成测试表将保存已完成测试的结果。每个用户只能进行一次不完整的测试。在未完成测试表中,我们会将问题链接回问题表(糟糕的是我错过了关系线),这将链接到可能的答案,我们将用户给出的答案记录在未完成测试表的字符串列中。 / p>


Example Question Types So Far:

  • Multiple Choice Single Answer (think radio button)

  • Multiple Choice Multiple Answer (think checkbox)

  • Matching (now there are many permutations of possible selections)

I want to store them in a database structure that could be used for these and many more types of questions in the future, so I'm trying think of a way for it to be... expandable?

Right now I have (your recommendation does not have to be constrained by this however):

  • Questions table
  • Answers table
  • ChosenAnswers table
  • Users table

One Question can have many Answers. One User/Question pair can have many ChosenAnswers.

However I can't make this work well with Matching as far as I can tell, and I'm also not 100% convinced it will work easily for multi-answer, easily meaning the least amount of logic needed when calculating a persons total score, etc.

Can anyone think of a design that would allow me to use all three of these types of quiz questions as well as adding future ones? I need some inspiration, a paradigm shift if you will...

An example of future question types could be 'put these list of things in the proper sequential order'... etc.

There has got to be a way, however complicated it may seem, to account for all of these different possible question types while still letting me use a fairly straight forward way of calculating total score for a quiz for reporting purposes, and so forth.

Please let me know in the comments here if there is any details I am missing, but it may be best to just assume that I have not even considered a detail you are thinking of, because I've put everything I have in the question already, but I will add clarity as it is requested.

解决方案

In the design below we will use a series of flags in the questions table to indicate what type of question it is. We also indicate the level of the question. The answer table is linked to the question table via the foreign key. The complet test table will hold the results of complet tests taken. Only one incomplete test is allowed per user. In the incomplete test table we will link the question back to the questions table (oops I missed the relationship line), which will link to the possible answers we record the answers give by the user in a string column of the incomplete test table.

这篇关于您是否可以为测验问题和答案推荐一个数据库设计,以允许大量的问题类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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