I am designing a database that contains questions, answers and categories.
One question can belong to many categories, and one category can have many questions.
So this relationship is a many-to-many.
One question table
One category table
One table containing primary keys of the two tables above
So now my question is, is it necessary or “better” to store answers (a, b, c, d, e) in a own table named answers? Then the answer table has a foreign key to the primary key in the question table.
Or should I just have 5 columns in the question table containing the answers as well with the correct answer?
After what I read it is not normal to have a one – to – one relationship.
Thanks in advance!
Make a separate
answerstable. There are two benefits:The answers table should look like this:
Now, you store one answer in one row… and for serial_number (a,b,c.. or 1,2,3.. or i, ii, iii,… whatever) you use
serial_numberfield.is_correctpoints to correct answer/s.You can select list of answers by