Poll Database Schema

前端 未结 4 1413
我寻月下人不归
我寻月下人不归 2021-02-01 05:15

What is the best database schema for polls? Is one-to-many relationship good for this? I\'m thinking about having two tables:

poll_questions
    int id
    varch         


        
相关标签:
4条回答
  • 2021-02-01 05:23

    Note: the "votes" column of the poll_answers table isn't necessary. Votes can be determined by querying the Poll_voting_history table.

    0 讨论(0)
  • 2021-02-01 05:23

    I think that question_id in poll_voting_history is not necessary as well, since each answer points to a question, so based on a answer_id you can get the question_id that it belongs to.

    0 讨论(0)
  • 2021-02-01 05:26

    I would like to add the status of poll_questions and poll_answers as well, just in case if we need to activate or disable the current poll question during given date and time.

    0 讨论(0)
  • 2021-02-01 05:36

    The schema looks good, and yes, you'd need to track the user votes as well.

    0 讨论(0)
提交回复
热议问题