I hope you understand my problem. An excerpt of my MySQL database looks like that:
To ensure data integrity two constraints must be implemented:
- Given an answer record, both "referencial paths" have to lead to the same exam record.
- Every exam_student must answer every questions. In other words: There should be an exam_question_result for each pair of exam_question and exam_student related to the same exam.
How can I realize these constraints in my database?
Solution 1 (referring to comments under this post):
I updated the schema using composite keys.