[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.
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.
Re: schema for storing polls