|
-
Dec 26th, 2007, 04:27 AM
#1
Thread Starter
Addicted Member
[RESOLVED] schema for storing polls
Hello,
I have thought of using the schema explained below to store the poll questions, answers and votes received.
1- Table 'poll_questions' - columns: id(primary key), question
2- Table 'poll_answers' - columns: id(refers to id of poll_questions), answer, votes received. id+answer will be the primary key.
Other option would be to have a separate table(poll_answers) to store the answers for each question and a table(poll_votes) to store the id of the question in poll_question and id of the answer in poll_answer and the actual number of votes received.
Which is a better option among the ones mentioned by me? Would you suggest something else?
Thank you.
-
Dec 26th, 2007, 08:50 AM
#2
Re: schema for storing polls
Your schema is fine.
Having a compound primary key in the poll_answer table is good form in my opinion.
I see no reason to move the votes into another table - they simply relate to the answer for that question - so leaving them in the poll_answer table is also good form.
-
Dec 26th, 2007, 08:55 AM
#3
Thread Starter
Addicted Member
Re: schema for storing polls
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|