2

It's a question & answer based model, and here is the scenario:

  1. A question with multiple choices given, with 3 to 7 correct answers among those choices.
  2. A question with multiple choices given, with only one correct answer among those choices.
  3. A question with no choices given, with only one correct answer, and the solver will have to come at that answer themselves.

What I have done so far:

answers:

  • content (text-based column, length could be of 100 - 150 chars)
  • question_id (foreign_key)
  • correct_answer (boolean)

questions:

  • id (primary key)
  • content (text-based column, length could be of 100 - 150 chars)
  • multiple_choice (boolean)

Having a column multiple_choice, so in case if it's false, it means the particular question will be given no choice, and the solver will have to provide the answer all by themselves.

Issue:

Given that an answer only has to store a string of few characters, a boolean of either correct or not, why can't/shouldn't I store it as datatype jsonb in the questions table?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.