Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:50:02+00:00 2026-06-14T13:50:02+00:00

I have some table: Course: contain info about course, one course has many topics.

  • 0

I have some table:

  • Course: contain info about course, one course has many topics.
  • Topic: contain info about topic, one topic belongs to one course and one topic has many questions.
  • Question: contain info about question, one question belongs to one topic.
  • GeneralExam: Contain info about the exam of a course, one general exam belongs to one course.
  • GeneralQuestion: Contain set questions of General Exam.

This is columns of two table:

  • GeneralExam: name, description, semester, duration, user_id, course_id, used (boolean), number_question
  • GeneralQuestion: general_exam_id, question_id

The questions will be get for GeneralExam is random. It means I will get random questions depend on specific number of question of each topic.

Now I want to know specific information of an general exam, like the number of questions of each topic in course which was made a general exam. Currently, I think I will create a new table to store that info, something like:

  • New table: general_exam_id, topic_id, number_question

But I don’t know if this is the best way to do it, or maybe in this case, has other ways or patterns to solve. Because If I create that New table, when I make a change in GeneralExam table(ex: change set questions), I will need to update 3 table: GeneralExam, GeneralQuestion, New table. I don’t sure it is the good way.

So I want to ask, should I create new table to store that information (number of questions of each topic in course of a general exam),

Or should I need to make some changes in table GeneralQuestion for store info of general exam better, and what changes I should do? Thanks for any suggestions and advices.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:50:03+00:00Added an answer on June 14, 2026 at 1:50 pm

    We are trying to say, that is not required to create a new extra table. You want to manage your schema efficiently with mimimal touches to tables.

    Design Rules:

    One should not confuse the numbered topics in a particular course book to Topic table’s ID numbers. Course doesn’t necessarily have to be belonged to an Exam. It’s the Exam who must belong to a Course. You have gotten your design so far correct. I assume you are storing all Questions for an Exam in GeneralQuestion table which acts like sort of a question bank of past Exams (including the schedule Exam in the near future which only gives access to the Exam moderators).

    Makes more sense to rename your GeneralQuestions table into ExamsQuestions. With this bank your design makes two virtual question types: Exam questions from the bank and questions from Question table where Exam questions are referencing to your Question table. So that gives your the required referencial key to Exam question bank. In my opinion it is a history table. It seems like, your final table that you are not sure should ideally be just a stored query providing real time data.

    Main question : Are you planning to store each past/scheduled-future Exam’s questions? You say Yes. Hence,

    Date becomes very crucial column in your Exam table according to the design I have provided. You need both Date & Course ID in Exam table.

    Following is how I would suggest the table schema.

    • Reference on SQLFiddle

    tblCourse

    ID, Course

    ID  NAME
    b105    biology 1st year
    c323    chemistry 1st year
    e120    english 1st year
    m122    maths 1st year
    m250    maths 2nd year
    p302    physics 3rd year
    

    tblTopic : Although ID is indexing, the CID is what recognizes the Topic’s Parent (the Course)

    ID, CID, Topic

    ID  CID     NAME
    t1  m122    Algebra
    t2  m122    Probability
    t3  e120    Essay Writing
    t4  p302    Optics
    t5  b105    liver system
    t6  b105    neural system
    t7  p302    mechanics
    

    tblQuestion : Although ID is indexing, the TID is what recognizes the Question’s Parent (the topic)

    ID, TID, Question

    tblExam : Although ID is indexing, the CID is what recognizes the Question’s Parent (the course)

    ID, CID, Exam, Date
    
    ID  TID     QUESTION
    q1  t2  x
    q10 t7  p
    q11 t4  n
    q12 t6  i
    q13 t7  r
    q14 t6  k
    q2  t1  y
    q3  t1  z
    q4  t2  a
    q5  t2  v
    q6  t6  s
    q7  t6  h
    q8  t1  l
    q9  t2  g
    

    tblExamsQuestions : Foreign Keys : Exam ID, Question ID

    ID, QID

    ID  CID     EXAM    DATE
    e1  b105    1st Year Biology Main Stream    June, 08 2012
    e2  m122    1st Year Maths Elective     December, 20 2011
    e3  b105    1st Year Biology Main Stream    February, 10 2012
    

    Application:
    Somebody wants to get last year’s Exam Questions for 1st Year Maths Course. How do you query that? If Exam ID is are on auto increment then it’s very hard to know what which id is what exam. So here you could be able to search questiosn for a particular course exam only with course id and date the exam held. That should do the job -> Unless same course exams held multiple times on the same day. Then you can save your data by Time as well. You can remove Date, Time as long as you change your Exam table design to query by Exam ID where the ID is a proper exam ID not just 1, 2, 3, …

    Course ID = m122
    Date = Last Year/Month/Date

    These are the most logical/important details which will work as a COMPOSITE SEARCH KEY you need to find the Exam ID from Exam table and use that in ExamsQuestions bank to pull the Exam questions.

    select * from question
    where id in (
    select eq.qid from examsquestions eq 
    inner join exam e 
    on e.id = eq.id
    where e.date = '2011-12-20'
    and e.cid = 'm122');
    
    ID  TID     QUESTION
    q1  t2  x
    q5  t2  v
    q7  t6  h
    

    By the way since you are choosing questions randomly for an Exam – I would be so worried that if I have to take that Exam. Because the risk of getting all questions from one topic is pretty wide. Anyway that’s a side issue which I hope you have a unbiased yet FAIR mechanism to generate Exam from all topics for a course 😉

    Let me if you have further doubts. Anyone please throw some light to improve ideas for better solutions.

    PS: Sorry for the late reply.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some td elements ( .nav_item ) in table. Also I have one
i have some troubles filling a predefined table with a stored procedure. mytable has
I have a USER table and a COURSE table. A USER can have many
I have some table: Title 1 | Title 2 | Title 3 | --------------------------------------------------
I have some table: table ASK with idask table PREFERENCES with idpref , fk_idask
I have some table structure: <tr class=row-2><tr> <tr class=row-3>..<tr> <tr class=row-4>..<tr> <tr class=row-5>..<tr> <tr
I have some table DOCUMENTS that have a column TYPE_ID and a table named
UPDATED: I have some table with sync_numbers, like this: --------------------- id | sync_number ---------------------
Fiddle: http://jsfiddle.net/MhWm5/16/ I have some dynamically generated table rows/values with dynamic IDs <td class=control-group>
I have some indexes in a table which name is a number(1,2,3,4...) But when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.