packy
10 months ago

DB Schema: multiple choice and fill in the blank Q & A

Posted 10 months ago by packy

I am creating an app where one part of the application has a piece of content, say similar to a blog post, and at the bottom there is a set of questions. The questions can be multiple choice or fill in the blank. They are all required. There are no right answers. My idea is to have a simple DB structure that grabs pre populated answers if the question type is multiple choice and lets the user add an entry to the answer table if its fill in the blank. Then what ever they select or write is associated to the user in a join table:

Questions

id  :  content_id  :  body  :  type. :  created_at  :  updated_at

Answers

id  :  question_id  :  body  :  created_at  :  updated_at

Answer_User

answer_id  :  user_id

Does this seem like a good solution? Is there other ways people have done this in the past?

Please sign in or create an account to participate in this conversation.