How to represent multi valued subtype in the EERD?

670 views Asked by At

I'm trying to represent a question in the EErd. The question can be a true/false question or a multiple choice question. If it's a multiple choice question question then I will need to add its answers, so I've created a sub-type that has a choiceChar (a,b,c,d) and choiceValue:

Question mcq EERD

Now I'm wondering if I should use the multi-valued notation for the choiceChar and choiceValue attributes since each multiple choice questions will have more than one answer or should I leaved it as a single value since I will represent the choiceChar and the choiceValue at the same table.

My question is how to represent multi valued sub-type in the EERD to achieve the ability to have both a choiceChar & choiceValue?

1

There are 1 answers

0
reaanb On

Based on your examples of choiceChar/choiceValue, I believe you have a functional dependency choiceChar -> choiceValue. This means that it's not correct to model the two elements as independent multi-valued attributes - rather, choices should be modeled as an entity set in a one-to-many relationship with questions.

multiple choice question ERD

I made choice a weak entity since I believe different questions can have choices with the same choiceChar, so we can identify choices by a compound key (qId, choiceChar).

Physically, this is implemented like so:

multiple choice question table diagram