How to improve a ERD

风流意气都作罢 提交于 2019-11-28 13:01:45

Reviewing the first diagram as the Logical model, typically the tables defined in the Logical also exist in the physical - you're missing the QUESTION-TAGS (nee QUESTION-SUBJECTS) table. You have a one-to-one relationship between QUESTION and MONITOR-CHECK, which means there's no value to having MONITOR-CHECK - move the attributes into the QUESTION table.

Viewing the second diagram as the Physical ERD model - there's no benefit to having two tables with a one-to-one relationship. I'm speaking about the QUESTION / QUESTION-BODY, and QUESTION / MODERATOR-CHECK tables.

QUESTION-SUBJECTS is poorly named - if by your note the record represents a "tag", then name the table accordingly. This table would be a code table (having CODE, DESCRIPTION columns) because you want to keep the values consistent for queries to perform well. That said, you need an xref/lookup/corollary table between the QUESTION and QUESTION-TAGS table in order to have a one [question related] to many [question tags].

QUESTION-TAG-XREF

  • QUESTION-ID (pk)
  • QUESTION-TAG-CODE (pk)

This is my reply to rexem's answer.

I understand your answer as follows:

alt text http://files.getdropbox.com/u/175564/db-problem-2.png

and the second diagram as

alt text http://files.getdropbox.com/u/175564/db-problem-1.png

I left the xref table for the question-body because I may need to store the changes to my questions too in the future.

The first diagram looks a bit more like a class diagram.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!