Hi all, I am using mySQL and coding with python/django for a quiz application. (I’m calling each quiz a “challenge” btw)
Setting up a “challenge” table and a “challenge_question” table is pretty straightforward. However, because I want to have different types of questions, I can’t yet figure out how to store the challenge_options (potential answers)
My questions types are: multiple choice, true/false, ordering, and fill-in-the-blank. I wonder, should I have a separate table for each type of challenge-question-option? Or is it possible to combine these into one somehow…
Here are my tables for challenge and challenge_question:
challenge table:
id
name
num_questions (I want to randomize and only display a certain number of Qs per each challenge)
challenge_question table:
id
challenge_id
question (text of the question)
required (some questions will be required to be displayed per each challenge)
question_type (here I indicate what type of question: Mult. choice, T/F, Ordering, or Fill-in-the-blank)
The tricky part is storing the ordering options. With this type of question, I present possible sequential steps that need to be ordered properly. So an “answer” to this question is in the sequence of options, not just the option itself.
If I combined all possible options into a single table, it might look be something like this
[B]challenge_options table:[/B]
id
challenge_question_id
option (text field, can be used for both multiple choice and for fill-in-the-blank style questions)
is_true (boolean field for true/false questions)
is_correct (boolean, used to determine multiple choice answer)
ordering_option_1
ordering_option_2
ordering_option_3
ordering_option_4 (these ordering fields would store the correct sequence of an ordering style of question)
I feel like this solution could work, but it seems less than ideal…
Appreciate any feedback, criticism, or suggested alternative approaches!