I am trying to create a question bank to help students access material during the pandemic.
I want to be able to classify each question so that students can go and search for specific topics at ease, and I am planning to store question-specific data in a table.
However, I'm finding it a bit difficult on the best way to store question specific data in a table.
For example, a probability question can be associated with multiple tags eg 'independence', 'mutually exclusive', 'tree diagram', but I can't have a variable number of tags in a single cell. And it is not possible to have an infinite number of columns in a given row.
Or maybe I am incorrect, is it possible to store an array of such tags in a single cell in MySQL? Does anyone have any more effective solutions?
Well, you need have a many to many relationship and need three tables:
question table
QuestionId, QuestionText
1. Is Corona contagious?
2 Malaria medication
3. Flue medication
tag table
TagId, TagText
1 Contagious
2 Virus
3. Medication
question_tag table
QuestionId, TagId
1 1
1. 2
2. 3
3. 2
3. 3