Computers & Electronics

Help with an ERD diagram

  • Last Updated:
  • Jul 21st, 2020 11:11 am
Tags:
[OP]
Deal Addict
May 11, 2003
2754 posts
571 upvotes

Help with an ERD diagram

Working on a project where I need to put together an ERD diagram. I'm trying to model some students who are being asked to write an exam, but the students will get one of three possible exams. Is what I'm showing below the right way to do it? The part I get confused on is that the Student will only get one of the three exams. Therefore, if the Students gets Exam #1, there is a value in Exam1_ID only. Exam2_ID and Exam3_ID will always be blank?

And if it looks like I don't know what I'm doing, it is because I don't.
2020-07-20_15-14-41.png
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.
3 replies
Deal Addict
Jun 8, 2005
3131 posts
601 upvotes
Toronto
The way I would model this would be with 4 tables:

Student, Exam, Questions, ExamAnswers

With Students containing all students (e.g. StudentID), Exams containing all exams and Questions containing all exam questions. You have a foreign key between Questions and Exams, to link the questions to exams. And for ExamAnswers you have a FK to both Questions and Student, to associate every answer with a specific student & exam.

Note that there are no constraints in this model limiting a student to a single exam. So while I may have done a good part of your homework, maybe the answer is incorrect. I don't know, I didn't see the original requirements.
[OP]
Deal Addict
May 11, 2003
2754 posts
571 upvotes
trane0 wrote:
With Students containing all students (e.g. StudentID), Exams containing all exams and Questions containing all exam questions. You have a foreign key between Questions and Exams, to link the questions to exams. And for ExamAnswers you have a FK to both Questions and Student, to associate every answer with a specific student & exam.

Note that there are no constraints in this model limiting a student to a single exam. So while I may have done a good part of your homework, maybe the answer is incorrect. I don't know, I didn't see the original requirements.


First off, thanks very much! Were you thinking something like in the image?

I'm a little confused about part of your answer. It says to link the Student and the Exam? Should that be Student and Questions?
2020-07-20_19-14-29.png
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.
Deal Addict
Jun 8, 2005
3131 posts
601 upvotes
Toronto
e-man wrote: First off, thanks very much! Were you thinking something like in the image?

I'm a little confused about part of your answer. It says to link the Student and the Exam? Should that be Student and Questions?

2020-07-20_19-14-29.png
Yes, link the answer to the student and question (and by extension to the exam the question is a part of).

Top

Thread Information

There is currently 1 user viewing this thread. (0 members and 1 guest)