0% found this document useful (0 votes)
13 views3 pages

Quiz Data Model

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

ia

Tr
Default Layout Hover columns to read the comments 23-03-2022 @ DbSchema

a
em

ch
ch
quiz

bS
bS
student_answers

D
D
id int
question_id int
answer long varchar
correct boolean

correct here is

question_id
assgined by teacher Preventing question
for the student answer from having one answer
is byoned the data model
this validation is left to
other layers to handle
student_quiz quiz_id
id int quiz quiz_id question question_id question_answers
quiz_id int id int id int id int
l

l
ia

ia
student_id int title long varchar order int letter char(1)
Tr

Tr
due_date date teacher_id int prompt text long varchar answer long varchar
quiz_id int correct boolean
a

a
question_id int
em

em
student_id

teacher_id

No need for question type


ch

ch
any question that has child rows correct here is
bS

bS
in question_answers table selected by the teacher
D

D
is considered a multipal chice when adding question
question answers

Lets assume we have three roles:


user role_id user_roles
admin
id int id int
name varchar(100) role varchar(100) teacher
role_id int student
Default Layout

Table question
No need for question type
any question that has child rows
in question_answers table
is considered a multipal chice
question
* Pk id int
order int
* prompt text long varchar
* quiz_id int
Indexes
Pk pk_question id
Foreign Keys
fk_question_quiz ( quiz_id ) ref quiz ( id )
Options
engine=InnoDB

Table question_answers
Preventing question
from having one answer
is byoned the data model
this validation is left to
other layers to handle
* Pk id int
letter char(1)
* answer long varchar
* correct boolean correct here is
selected by the teacher
when adding question
answers
question_id int
Indexes
Pk pk_question_responses id
Foreign Keys
fk_question_answers_question ( question_id ) ref
question ( id )
Options
engine=InnoDB

Table quiz
* Pk id int
title long varchar
* teacher_id int
Indexes
Pk pk_quiz id
Foreign Keys
fk_quiz_user ( teacher_id ) ref user ( id )
Options
engine=InnoDB

Table student_answers
* Pk id int
* question_id int
answer long varchar
Table student_answers
correct boolean correct here is
assgined by teacher
for the student answer
Indexes
Pk pk_student_answers id
Foreign Keys
fk_student_answers_question ( question_id ) ref
question ( id )
Options
engine=InnoDB

Table student_quiz
* Pk id int
* quiz_id int
student_id int
* due_date date
Indexes
Pk pk_student_quiz id
Foreign Keys
fk_student_quiz_quiz ( quiz_id ) ref quiz ( id )
fk_student_quiz_user ( student_id ) ref user ( id )
Options
engine=InnoDB

Table user
* Pk id int
name varchar(100)
role_id int
Indexes
Pk pk_tbl id
Foreign Keys
fk_user_user_roles ( role_id ) ref user_roles ( id )
Options
engine=InnoDB

Table user_roles
* Pk id int
* role varchar(100) Lets assume we have three roles:
admin
teacher
student
Indexes
Pk pk_user_roles id
Options
engine=InnoDB

You might also like