Mic*_*ick 7 sql database database-design database-schema
我一直在考虑如何设计一个数据库,以便在一年多的时间内保持考试问题(开启和关闭,主要是关闭).
首先,简要介绍一下我所追求的内容.我想设计一个足够灵活的数据库来存储不同的问题类型(例如,简短回答或多项选择问题),并且能够选择任意数量的这些问题作为考试存储.
我的问题是:
如何存储考试题?
由于不同的问题类型需要存储不同的字段,如果我将它们全部放在同一个表中questions,将会有许多从未使用过的额外字段.
如果我将问题类型分成不同的表,那么将question_id存储在某个exam_questions表中将会困难得多,因为它们将来自不同的表.
我也想不出一种灵活的方式来存储信息.
例如,
questions
- id
- question
- type (multiple choice, short response)
- choice_1 ( used for multiple choice questions)
- choice_2
- choice_3
- choice_4
- choice_5
- answer (short response answer here, or just a/b/c/d/e for multiple choice, t/f for true or false)
Run Code Online (Sandbox Code Playgroud)
这样的设计会被推荐吗?如果没有,有没有人有任何建议?
我还有另一个问题:
如果我想将学生的答案存储到这些考试中,那么将它们存储起来效率是否低效?
exam_responses
- id
- student_id
- exam_id
- question_id or question_number
- response
- mark
Run Code Online (Sandbox Code Playgroud)
先感谢您.如果您想要任何其他信息,或者此问题有任何问题,请给我留言,我会尽快修复.
two*_*rse 11
我会有单独的问答表,并使用question2answer表加入它们
question
--------
- id
- question
- type (multiple choice, short response)
answer
------
- id
- GUIorder (so you can change the sort order on the front end)
- answer
question2answer
---------------
- questionid
- answerid
Run Code Online (Sandbox Code Playgroud)
现在,在构建问题方面,一切都是动态的,而且没有空列.快速联接可以让您回到主要问题的所有部分
您的exam_responses表现在可以具有以下内容
- id
- questionid
- answerid
- studentid
- response
- mark
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11107 次 |
| 最近记录: |