I read my notes and I am now unsure about the keys.
My logical diagram
alt text http://files.getdropbox.com/u/175564/db/db-11.png
This table should be in line with the following physical ERD
alt text http://files.getdropbox.com/u/175564/db/db-22.png
I have only one foreign key in the table Question.
I would like to know
- should the
question-idandquestion-tagin the table Question-tag-xref, ANDquestion-idandanswerin the table Answers be also foreign keys?
Masi – Logical models don’t usually contain data type (string, int, etc) information, but do indicate if the attribute (becomes a column in the Physical model) is optional (able to be null or not).
That said, yes – the QUESTION-ID and QUESTION-TAG columns would be foreign keys in the QUESTION-TAG-XREF table. Here’s a physical view of QUESTION-TAG-XREF:
QUESTION-TAGS-XREF
Both columns are the pk to ensure you can’t have duplicate tags for a given question.
You are correct that QUESTION-ID would be a foreign key in the ANSWERS table, in reference to the QUESTION table.