Home > Mobile >  Database Structure assistance
Database Structure assistance

Time:10-15

I'm doing an online exam system but I'm struggling with the database Structure,

what I do in native PHP is creating separate tables for example:

Table quiz info have this fields {
   id
   owner
   quiz_name
   question_qnty
}

Table questions have this fields{
   id
   quiz_id
   question_number
   question
}

Table answers have this fields{
   id   
   quiz_id  
   qeustion_number  
   answer   
   isright  
}

but the issue is I can't do that with laraVel as I know and tried, What I want is to let the user up to 12 questions and 4 answers, but unfortunately, I couldn't I hope someone helps me.

CodePudding user response:

A database can represent the data, and the physical relationships between the various sets of data ... e.g. linking a "question" record to the "quiz" that it belongs to, ensuring that there are no "orphan questions," and so on.

But the database cannot enforce "business rules," such as "up to X questions and Y answers." Such concerns are strictly up to the you-programmed logic of your application.

At each and every appropriate time when the user tries to add another question or to add another answer, the logic of your application must consider and enforce the limit.

  • Related