mysql – 如何规范测验应用程序的数据库模式?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了mysql – 如何规范测验应用程序的数据库模式?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1636字,纯文字阅读大概需要3分钟。
内容图文
参见英文答案 > Data Model for Online Examination – Matching Questions 1个
我正在组织一个测验申请. (我把每个测验称为“挑战”)
我有一个“挑战”表和一个“challenge_question”表非常简单.
challenge table:
id
name
num_questions (I want to randomize and only display a certain number of Qs per each challenge)
challenge_question table:
id
challenge_id
question (text of the question)
required (some questions will be required to be displayed per each challenge)
question_type (here I indicate what type of question: Mult. choice, T/F, Ordering, or Fill-in-the-blank)
我在规范化方面遇到问题的地方是问题选项的类型:多项选择,真/假,排序和填空.我想知道,我是否应该针对每种挑战问题选项单独设置表格?或者是否有可能将这些组合成一个…
如果我将所有可能的选项组合到一个表中,它可能看起来像这样
challenge_options table:
id
challenge_question_id
option (text field, can be used for both multiple choice and for fill-in-the-blank style questions)
is_true (boolean field for true/false questions)
is_correct (boolean, used to determine multiple choice answer)
ordering_option_1
ordering_option_2
ordering_option_3
ordering_option_4 (these ordering fields would store the correct sequence of an ordering style of question)
这真的让我觉得不太理想.实际上,我没有看到ordering_options如何正常工作.难道我不需要让每个人都单独选择吗?当然必须有更好的方法.有任何建议/批评或替代方法吗?
解决方法:
而不是选项我将使用另一个表option_type与PK和名称字段,并在challenge_options中使用fk关系.您可以轻松添加新的挑战.
我不确定我是否会在challenge_options中使用is_true / is_correct.我会使用第二个表,其中包含user_id,challenge_options_id和布尔值正确/ false.
内容总结
以上是互联网集市为您收集整理的mysql – 如何规范测验应用程序的数据库模式?全部内容,希望文章能够帮你解决mysql – 如何规范测验应用程序的数据库模式?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。