Click here to Skip to main content
15,998,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello , i am working on online exam project, In that i have a query i.e. suppose we have same question for different subject ,then how to save them in database
Eg who is the HOD , IT can b asked in any subject, whether it is cs, or electronics.
so how i store these type of question in database.
Posted

If I understand your question correctly, you have a many-to-may situation. In that case you should use a structure like:
- Subject table, contains different subjects such as cs, electronics, and so on
- Question table contains individual questions
- SubjectQuestion table contains questions linked to subject.

This way one subject can have multiple questions and one question can be usied for multiple subjects. The principle is called junction table, for more information, see Junction table - Wikipedia, the free encyclopedia[^]
 
Share this answer
 
Without knowing your current database structure it will be a little difficult to tell you a better way. However this how it should probably look soemthing like this:

QuestionTable
    QuestionId
    QuestionText
    DepartmentId
    CourseId
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900