0

I'm developing a website and I need to store some question. I've a json like:

[{"id":"1","resp":"y"},{"id":"2","resp":"m"},{"id":"3","resp":"m"},{"id":"4","resp":"m"},{"id":"5","resp":"n"}

id = id question, resp = answer

I need to store this information and compare it with other user. What's the best way? Store one single json for user o create a database like

        idquestion1 idquestion2 idquestion3 idquestion4
user        yes         no          yes         boh

Now I use Php+mysql

2
  • Relational databases store data in such a way so that the user (you) can extrapolate certain relation. Comparing one user to another user sounds like a relation to me. Therefore, by your definition there - the answer is obvious. Save data in a format that's usable by database and you. Commented Oct 2, 2013 at 13:47
  • Yeah I think is the best solution Commented Oct 3, 2013 at 12:56

1 Answer 1

1

This would be the best table design imho:

user_id | question_id | answer
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.