views:

12

answers:

1

I have an idea of how to fix this but I was wondering what the best way to go about this.

So one Question can have multiple Answers Question and Answers can have points A user is only allowed to give points per question/answer

Question:
  id
  title

Answer:
  id
  question_id
  response

Points:
  id
  user_id
  question_id
  answer_id
  points

So as you can see the problem is the Points table with question_id and answer_id. Now I think I could solve this by having Points_Question table and Points_Answer table, then I could join the tables for total_points. Is this the best solution?

A: 

you don't need to add questionid in points table as question can be accessed through answerid in answer table.

Tassadaque
No but a question can have points too.
Scottix
so you mean in points table either you have answerid or questionid along with other fields. if this is the case then see this link http://stackoverflow.com/questions/3407951/best-way-to-design-this-database-scenerio i would prefer solution proposed by martin. You need to make two junction tables answer_points and quetion_points.
Tassadaque