I just want some advice, when creating a “Question” Table in the database, do I need store in the question number for each question or is this not needed as each question will have its own unique Id thanks to auto increment and that when students take the exam, the questions are going to appear in random order for each student so they can’t copy answers.
In other words should the Question table be like this (Example 1):
QuestionId (int 11) auto increment PK //unique identifier for each question
QuestionNo (int 3) //the question number
QuestionContent (varchar 800) //the question itself
AnswerId (int 11) //Foreign key to AnswerId in Answer Table
Or should it be like this (example 2):
QuestionId (int 11) auto increment PK //unique identifier for each question
QuestionContent (varchar 800) //the question itself
AnswerId (int 11) //Foreign key to AnswerId in Answer Table
I think you answered your own question. The auto-increment PK field means that each question will have a unique ID number. The only reason you’d need to provide another question number field is if you need to be able to find questions according to some other numbering system that’s already determined, or if the question number has some other significance.