I may lack the mathematical background to find the right answer for myself. I have tables set up like so (irrelevant columns omitted):
Questions
queID
Answers
queID
ansID
Users can create quizzes by picking certain questions. Answers are the possible answers users can choose from per question.
Sessions
sessID
When a customer picks a group of questions to answer, a "Session" is created.
SessionQuestions
sqID
sessID
queID
These are the questions a user selected for a given session.
Where I'm hitting a snag is at the SessionAnswers
level. The order of answers for a question can be random. That is, a multiple-choice question with default answer order of A,B,C can be displayed as C,B,A to a user. Whenever they view that question again, though, it still needs to be C,B,A, so that final order needs to be stored. My tentative table is this:
SessionAnswers
sqID
ansID
saOrder
The thing is that sqID points to queID, but so does ansID. That means that I could use sessID
on this table or sqID
. I'm not sure which one to pick. This setup still makes it possible for ansID to be mapped to an answer that is mapped to a question that is not even on SessionQuestions, which would be incorrect. Can I improve the setup to avoid that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…