我只是想要一些建议,在数据库中创建“问题”表时,我是否需要存储每个问题的问题编号,或者是否不需要,因为每个问题都会有自己的唯一 ID,这要归功于自动递增和当学生参加考试时,问题将以随机顺序出现在每个学生身上,因此他们无法复制答案。
换句话说,问题表应该是这样的(示例 1):
QuestionId (int 11) auto increment PK //unique identifier for each question
QuestionNo (int 3) //the question number
QuestionContent (varchar 800) //the question itself
AnswerId (int 11) //Foreign key to AnswerId in Answer Table
或者应该是这样的(例2):
QuestionId (int 11) auto increment PK //unique identifier for each question
QuestionContent (varchar 800) //the question itself
AnswerId (int 11) //Foreign key to AnswerId in Answer Table
最佳答案
我想您已经回答了自己的问题。自动递增的 PK 字段意味着每个问题都会有一个唯一的 ID 号。您需要提供另一个问题编号字段的唯一原因是,如果您需要能够根据一些其他已经确定的编号系统找到问题,或者问题编号是否具有其他意义。
关于mysql - 哪个数据库表更好?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12682804/