Search
 
SCRIPT & CODE EXAMPLE
 

SQL

database schema for mcqs type exam in sql

CREATE  TABLE users (
  id int(10) auto_increment primary key,
  username VARCHAR(45) NOT NULL ,
  password VARCHAR(45) NOT NULL ,
  enabled TINYINT NOT NULL DEFAULT 1
);

CREATE TABLE questions (
    id int(10) auto_increment primary key,
    question varchar(800) NOT NULL,
    right_option int(10) NOT NULL references options(id)
);

CREATE TABLE options (
    id int(10) auto_increment primary key,
    question_id int(10) NOT NULL references questions(id),
    `option` varchar(150) NOT NULL
);

CREATE TABLE exam_details (
    id int(10) auto_increment primary key,
    username varchar(45) NOT NULL references users(username),
    date_of_exam date not null,
    exam_result varchar(10) NOT NULL, -- PASS/FAIL
    exam_score int(10) NOT NULL,      -- e.g. 40 
    no_of_questions int(10) NOT NULL  -- total no. of questions in the test
);     

CREATE TABLE user_answers (
    id int(10) auto_increment primary key,
    userId int(10) NOT NULL references users(id),
    question_id int(10) NOT NULL references questions(id),
    answer int(10) NOT NULL references options(id)
);
Comment

PREVIOUS NEXT
Code Example
Sql :: inner joint 
Sql :: the primary key is selected from the 
Sql :: ring SQLite create a SQLite database, add new records then display the data 
Sql :: format datetime mysql 
Sql :: oracle run_duration average 
Sql :: mysql where in keep order 
Sql :: add new column in table 
Sql :: group function in sql 
Sql :: sqlite rename table 
Sql :: sql compiler 
Sql :: select all same column value in sql 
Sql :: count with where 
Sql :: psotgres multiple values 
Sql :: sql script to delete duplicate records in a table 
Sql :: get id from just inserted row mysql server python 
Sql :: timing sql queries 
Sql :: luu ckeditor vao mysql 
Csharp :: unity get number of child objects 
Csharp :: c# get executable path 
Csharp :: c# check if type implements interface 
Csharp :: .net core temp directory 
Csharp :: C# get pc language 
Csharp :: read in multiple numbers c# 
Csharp :: degree to radians c# 
Csharp :: c# get free space on drive 
Csharp :: unity create cube in script 
Csharp :: format phone number in c# .net 
Csharp :: get request url in asp.net core 
Csharp :: how to create directory folder in c# 
Csharp :: how to exit application c# console 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =