I'm not sure if topic can get you understand what I want to explain. Follow guide in my old question, now I have these tables and its columns:

  • Course: name,...
  • Topic: name, course_id
  • Question: content, topic_id
  • GeneralExam: name, description, semester, number_question (total number of questions of general exam), duration, used (boolean), user_id, course_id
  • GeneralQuestion: general_exam_id, question_id

To sum up association:

  • Course - Topic: one-to-many
  • Topic - Question: one-to-many
  • Course - GeneralExam: one-to-many
  • Question - GeneralExam: many-to-many, join table: GeneralQuestion

Now, When creating new General Exam (GE) for a course, I want to specific a number of questions for each topic of that course, so that I can get questions for that GE ( I want to do(specific) it on form, I had a form for create new GE now). So, should I create new table to store a number of questions of each topic of course when creating new GE? If I should, how table I should design?

I image table I should design will like this (I can't get name of table now):

NameOfTable: general_exam_id, course_id, topic_id, number_question

Is this table good?

1 Answer 1


If the number of questions for each topic on each course varies from one General Exam to another, then yes, you want a structure like this (which is pretty much what you have):

GE_ID int FK
Course_ID int FK
Topic_ID int FK
MaxQuestions int
  • yes, every GE has different number of questions of course's topics. Ah, maybe I don't need Course_ID, because it's already in GE table, right?
    – Thanh
    Nov 18, 2012 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.