Reputation: 1600
I'm writing an application to allow users to create a Poll. They ask a question and set n
number of predefined answers to the question. Other users can vote on the answers provided for that question.
I have designed the database like this:
Current thinking is, I create a new column called vote_count
on the link
table and every time that answer gets voted, it updates the record.
This works. But is it right? I'm new to database systems, so I can't imagine I'm doing much right. What are some more efficient ways to achieve this?
Upvotes: 0
Views: 1342
Reputation: 7344
As far as it goes yes that's OK. However these tables will be incomplete. When your second quiz is created, you'll have to extend the QUESTIONS table. If this second quiz's Q1 also has a yes/no answer, you're going to have to extend the LINK/VOTES table.
You also have to think about how it's going to be queried and design indexes to support those queries.
Cheers -
Upvotes: 1