KEMBAR78
DB Structure | PDF | User (Computing) | Information Retrieval
0% found this document useful (0 votes)
7 views3 pages

DB Structure

The document outlines the schema for six database tables: chapter, question, quiz, subject, user, and user_quiz_progress, detailing their fields and relationships. Each table includes primary keys and foreign keys to establish connections between them. The user_quiz_progress table specifically tracks user performance on quizzes, including scores and answers in JSON format.

Uploaded by

RIYA CHANDRABEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

DB Structure

The document outlines the schema for six database tables: chapter, question, quiz, subject, user, and user_quiz_progress, detailing their fields and relationships. Each table includes primary keys and foreign keys to establish connections between them. The user_quiz_progress table specifically tracks user performance on quizzes, including scores and answers in JSON format.

Uploaded by

RIYA CHANDRABEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tables (6)

Name Type Schema

chapter CREATE TABLE chapter ( id


INTEGER NOT NULL, name
VARCHAR(120) NOT NULL,
subject_id INTEGER NOT NULL,
description TEXT, PRIMARY KEY
(id), FOREIGN KEY(subject_id)
REFERENCES subject (id) )
id INTEGER "id" INTEGER NOT NULL
name VARCHAR(120) "name" VARCHAR(120) NOT NULL
subject_id INTEGER "subject_id" INTEGER NOT NULL
description TEXT "description" TEXT

question CREATE TABLE question ( id


INTEGER NOT NULL, quiz_id
INTEGER NOT NULL, question_text
TEXT NOT NULL, option_1
VARCHAR(120) NOT NULL, option_2
VARCHAR(120) NOT NULL, option_3
VARCHAR(120) NOT NULL, option_4
VARCHAR(120) NOT NULL,
correct_option INTEGER NOT NULL,
PRIMARY KEY (id), FOREIGN
KEY(quiz_id) REFERENCES quiz
(id) )
id INTEGER "id" INTEGER NOT NULL
quiz_id INTEGER "quiz_id" INTEGER NOT NULL
question_text TEXT "question_text" TEXT NOT NULL
option_1 VARCHAR(120) "option_1" VARCHAR(120) NOT NULL
option_2 VARCHAR(120) "option_2" VARCHAR(120) NOT NULL
option_3 VARCHAR(120) "option_3" VARCHAR(120) NOT NULL
option_4 VARCHAR(120) "option_4" VARCHAR(120) NOT NULL
correct_option INTEGER "correct_option" INTEGER NOT NULL

quiz CREATE TABLE quiz ( id INTEGER


NOT NULL, title VARCHAR(120) NOT
NULL, chapter_id INTEGER NOT
NULL, date DATE NOT NULL,
duration INTEGER NOT NULL,
PRIMARY KEY (id), FOREIGN
KEY(chapter_id) REFERENCES
chapter (id) )
id INTEGER "id" INTEGER NOT NULL
title VARCHAR(120) "title" VARCHAR(120) NOT NULL
chapter_id INTEGER "chapter_id" INTEGER NOT NULL
date DATE "date" DATE NOT NULL

1
Name Type Schema
duration INTEGER "duration" INTEGER NOT NULL

subject CREATE TABLE subject ( id


INTEGER NOT NULL, name
VARCHAR(120) NOT NULL,
description VARCHAR(250) NOT
NULL, PRIMARY KEY (id) )
id INTEGER "id" INTEGER NOT NULL
name VARCHAR(120) "name" VARCHAR(120) NOT NULL
description VARCHAR(250) "description" VARCHAR(250) NOT NULL

user CREATE TABLE user ( id INTEGER


NOT NULL, username VARCHAR(80)
NOT NULL, password VARCHAR(120)
NOT NULL, full_name VARCHAR(120)
NOT NULL, qualification
VARCHAR(120) NOT NULL, dob DATE
NOT NULL, role VARCHAR(10) NOT
NULL, PRIMARY KEY (id), UNIQUE
(username) )
id INTEGER "id" INTEGER NOT NULL
username VARCHAR(80) "username" VARCHAR(80) NOT NULL
password VARCHAR(120) "password" VARCHAR(120) NOT NULL
full_name VARCHAR(120) "full_name" VARCHAR(120) NOT NULL
quali cation VARCHAR(120) "quali cation" VARCHAR(120) NOT NULL
dob DATE "dob" DATE NOT NULL
role VARCHAR(10) "role" VARCHAR(10) NOT NULL

user_quiz_progres CREATE TABLE user_quiz_progress


( id INTEGER NOT NULL, user_id
s INTEGER NOT NULL, quiz_id
INTEGER NOT NULL, score INTEGER
NOT NULL, completed_on DATETIME
NOT NULL, user_answers JSON,
PRIMARY KEY (id), FOREIGN
KEY(user_id) REFERENCES user
(id), FOREIGN KEY(quiz_id)
REFERENCES quiz (id) )
id INTEGER "id" INTEGER NOT NULL
user_id INTEGER "user_id" INTEGER NOT NULL
quiz_id INTEGER "quiz_id" INTEGER NOT NULL
score INTEGER "score" INTEGER NOT NULL
completed_on DATETIME "completed_on" DATETIME NOT NULL
user_answers JSON "user_answers" JSON

Indices (0)
2
Name Type Schema

Views (0)
Name Type Schema

Triggers (0)
Name Type Schema

You might also like