database schema for mcqs type exam in sql

Solutions on MaxInterview for database schema for mcqs type exam in sql by the best coders in the world

showing results for - "database schema for mcqs type exam in sql"
Angela
24 Apr 2017
1CREATE  TABLE users (
2  id int(10) auto_increment primary key,
3  username VARCHAR(45) NOT NULL ,
4  password VARCHAR(45) NOT NULL ,
5  enabled TINYINT NOT NULL DEFAULT 1
6);
7
8CREATE TABLE questions (
9    id int(10) auto_increment primary key,
10    question varchar(800) NOT NULL,
11    right_option int(10) NOT NULL references options(id)
12);
13
14CREATE TABLE options (
15    id int(10) auto_increment primary key,
16    question_id int(10) NOT NULL references questions(id),
17    `option` varchar(150) NOT NULL
18);
19
20CREATE TABLE exam_details (
21    id int(10) auto_increment primary key,
22    username varchar(45) NOT NULL references users(username),
23    date_of_exam date not null,
24    exam_result varchar(10) NOT NULL, -- PASS/FAIL
25    exam_score int(10) NOT NULL,      -- e.g. 40 
26    no_of_questions int(10) NOT NULL  -- total no. of questions in the test
27);     
28
29CREATE TABLE user_answers (
30    id int(10) auto_increment primary key,
31    userId int(10) NOT NULL references users(id),
32    question_id int(10) NOT NULL references questions(id),
33    answer int(10) NOT NULL references options(id)
34);
35
similar questions
queries leading to this page
database schema for mcqs type exam in sql