December 10th, 2012, 04:01 PM
Database design questions
I have few questions that i would like to ask:
1. If i am creating a system whereby there is a hierarchy of users (i.e. students, teachers, manager). should I store this in one table or three? avoids having to self join again and again to get relevant info?
2. if i need a system whereby I can set some questions and answers, or questions with multi-choice answers. How best should I store them?
Class_id, question_id,question,answer (for Q&A)
class_id,question_id,question,answer (for multiple choice Questions)
December 10th, 2012, 04:51 PM
Iwould do the following:
#1 For question1:
Store them in the same table but with a usergroup,
Make a second table to store user groups
id name groupID etc
33 John 3 xxx
*this allows you to add and alter groups or names and sort them by number
#2 For your second question.
I would make 2 tables (questions and answers)
and interlink them with their corresponding id's
The reason why you want 2 different tables is because you would otherwise duplicate data, which is unnecesary.
QID question type
22 What do gorilla's eat? multiple
AID QID answer
1 22 banana's
2 22 Soup
3 22 Lemons
Comments on this post
Last edited by aeternus; December 10th, 2012 at 04:57 PM.