I am a web developer who's working on an Exam Generator project. Now I am stuck at one point.
I have one database with different tables. Four of these tables are somehow similar with their columns. I want to know what is the best practice for such thing.
The similar tables I have are:
Exam (Used to store the exam name and the number of questions included in the exam).
ID | ExamName | NumberofQuestions
UserExam (Used to store the the exams availble for a user with his grade in each exam he took).
ID | MemberID | ExamID | Grade
QuestionExam (Used to store Question IDs included in each exam).
ID | ExamID | QuestionID
UserSolution (Used to store the user's answers for each exam he took).
ID | MemberID | ExamID | QuestionID | UserAnswer
In the beginning, I wanted to merge the "Exam" table with the "QuestionExam" table, but then I asked myself if I merged them how would I have one ID for each exam? So I kept it as it is.
Everything is correct with the tables. IF you want to be more desciriptive some practices say to value like Exam_ID, UserExam_ID, or UserSolution_ID that way you can distinguish between the two in a join. It all depends on personal preference. It is a little more writing but saves you from a headache in the long run.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.