Here you can see a visualization of each of relationships in our database conceptually and logically.
In the logical diagram, notice that there is a unique index on each of the conceptual primary keys and that the logical 'id's reduces the complexity (and therefore margin of error) of the relationship.
Conceptual Relationship Visualizations
Note that the key for the questions table isn't the question text and the user's e-mail. It is the user's primary key (which happens to be the e-mail) and the question text.
The key for the answers table is only two keys, not three - the primary key of the questions table (which happens to be a composite key) and the answer text.
Likewise, the key for the results table is only two keys, not four.
The key for the answers table is only two keys, not three - the primary key of the questions table (which happens to be a composite key) and the answer text.
Likewise, the key for the results table is only two keys, not four.
Logical Relationship Visualizations
Note the unique index on question_text, user_id in the questions table keeps the same constraints on the table that the conceptual key did.
Questions?
No comments:
Post a Comment