0

I am making a quiz portal and for that I am having a quiz table. Here I am saving the quiz id , quiz questions and quiz answers.

Now I am confused in the quiz answers part.

My question has 4 options so should I make 4 columns for four options, or should I make a comma separated list of 4 options and save in one column? Which will be the better choice?

halfer
  • 19,824
  • 17
  • 99
  • 186
Tarun
  • 271
  • 1
  • 6
  • 18

1 Answers1

1

Never store multiple values in a single column!

One way would be

questions table
---------------
id
quiz_id
title

answers table
-------------
id
question_id
answer_text

That way a question can have as many answers as you like.

juergen d
  • 201,996
  • 37
  • 293
  • 362
  • actually creating separate tables are leading to join queries while fetching . So join queries make the performance slow , so was thinking of comma separated String. – Tarun Nov 27 '17 at 10:56
  • That is nonsense. JOINS are the way to go and they don't make things slow. – juergen d Nov 27 '17 at 11:07