Fred
Fred

Reputation: 121

Which ER is correct?

I want to create a database. Right now I have 3 columns in my table: question, subject and keyword. The questiosn can be associate with multiple Subjects and Keywords. Which one of these two is the correct ER?

ER 1 enter image description here

ER 2 enter image description here

Upvotes: 1

Views: 89

Answers (2)

Bacs
Bacs

Reputation: 919

As your models stand, there is an issue with the attribute names in ER 2. Contains.SubjectID should be Contains.sID if it's to link to the Subject entity.

Assuming that's just a typo, and doesn't immediately disqualify ER 2, which is the "correct" model? Normalisation is important of course, but it's not the be all and end all. The correct data model depends on the system requirements. For example, using ER 1, it would not be possible to link a subject to one or more keywords without creating a question or questions which reference those subjects/keywords. With ER 2 it would be possible.

Maybe ER 1 is correct because it's more normalised, maybe ER 2 is correct because it's more flexible? Without knowing the requirements, there is no yardstick to measure the two models against, and so there isn't really a "correct" one.

Upvotes: 0

soroush gholamzadeh
soroush gholamzadeh

Reputation: 2784

First one without any doubt,You have some anomalies in second. looking at this could help you: wikipedia - database normalization

Upvotes: 1

Related Questions