Database structure for poll system

Asked

Viewed 497 times

0

I have a project to develop an online polling system. I am concerned about how I will get the answers to the questions to show in a graph. Each graph is each question to be analyzed. Let’s see, if I have a question that has 4 different answers, and that each question, only one answer can be marked. Basically, the structure would be:

1) pergunta um
   a) questao um
   b) questao dois
   c) questao tres
   d) questao quatro
   e) questao cinco
2)
   a) questao um
   b) questao dois
   c) questao tres

I need to help define the best criteria for storing these answers in the database. Basically, I need to know how many times in question 1, a, b, c, d, and, was selected to be shown the graph of question one. If I had a table in the following structure:

id_usuario 2
respostas ac

In this case user id 2 would have answered question 1, letter to and question 2, letter c. But the question would be, if I were to deal with that in programming, it would be a lot of work for me. I would like to know how best to develop this system according to these criteria.

1 answer

1


inserir a descrição da imagem aqui

In this case you need to set in the database (opcao_id, resposta_id, usuario_id) as a single index or deal with PHP at the time of insertion.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.