Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
814 views
in Technique[技术] by (71.8m points)

database - How to improve a ERD

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

I would like to know the following.

Does my sequence diagram match the following relation diagram?

alt text http://files.getdropbox.com/u/175564/table-problem-3.png

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...