How to improve a ERD

前端 未结 3 1288
时光取名叫无心
时光取名叫无心 2020-12-11 13:00

This question is based on my plan at the thread.

My entity-relationship diagram is

alt text http://files.getdropbox.com/u/175564/sequence-diagram.png

相关标签:
3条回答
  • 2020-12-11 13:30

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

    0 讨论(0)
  • 2020-12-11 13:37

    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.

    0 讨论(0)
  • 2020-12-11 13:46

    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)
    0 讨论(0)
提交回复
热议问题