February 18, 2009 at 10:34 am
OK,
I am modeling a small survey db and I would like the Questions in the Question table to be reusable as well as group of questions to be reusable with diff surveys. So I have been struggling with where to signify the page of the survey that the group belongs on. If I put this attribute in the QuestionGroup table then I limit the ability to make the groups reusable as another Survey might want that group on a diff. page.
Should I put this attribute in a SurveyQuestion Table instead?
SurveyQuestion
SurveyID PK,FK
QuestionID PK, FK
QuestionGroupID FK
GroupPage int
If I didn't provide enough info tell me and I will provide more.
Thanks!
February 18, 2009 at 12:09 pm
So, we have a Survey, a Question, and a Group? What's the Group do and how does it relate to both Question & Survey? It really depends on how the objects relate before you determine where they go in tables. From what I read, I would assume that Questions belong to Groups and Groups belong to Surveys. With that, I'd have five tables, one for each of the object types, then one that relates groups to questions and then another that relates groups to surveys.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 18, 2009 at 12:22 pm
Yes, that is exactly what I need, but what to call the Question to group join table?
Question
QuestionID PK
QuestionGroup Or Just Group? Group by itself seems to vague.
QuestionGroupID PK
JOIN TableName Here
QuestionGroupID PK, FK
QuestionID PK, FK
Survey
SurveyID PK
SurveyQuestionGroup
SurveyID PK, FK
QuestionGroupID PK, FK
February 18, 2009 at 12:30 pm
Chris Lane (2/18/2009)
Yes, that is exactly what I need, but what to call the Question to group join table?Question
QuestionID PK
QuestionGroup Or Just Group? Group by itself seems to vague.
QuestionGroupID PK
JOIN TableName Here
QuestionGroupID PK, FK
QuestionID PK, FK
Survey
SurveyID PK
SurveyQuestionGroup
SurveyID PK, FK
QuestionGroupID PK, FK
Well, it's not really a QuestionGroup is it? It's... a section? Maybe not... a topic? That sounds kind of right.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 18, 2009 at 12:39 pm
Sounds to me like Groups should be called Topics or something as mentioned before, but as for your "join" table, if it's a many-to-many relationship, I'd recommend QuestionsTopics, but then I also believe in using plural for most table names (Questions, Topics, Surveys).
February 18, 2009 at 12:44 pm
I used to believe in plural table names but not anymore and going back to Boyce and Codd they argued against using plurals for table names. I already know a table is a collection of rows in a RDBMS.
February 18, 2009 at 12:48 pm
Given my druthers, I go with a singular object name, but I've long ago stopped worrying about some of the silly stuff. This is especially true when we have people renaming deductable to ddltbl. Any idea where the second "l" came from? Me neither.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply