· 8 years ago · Dec 12, 2017, 03:42 PM
1drop database if exists entechnic;
2create database entechnic;
3
4use entechnic;
5
6CREATE TABLE IF NOT EXISTS mult_choice_questions (
7 id int auto_increment primary key,
8 question varchar(256) not null,
9 a varchar(256) not null,
10 b varchar(256) not null,
11 c varchar(256) not null,
12 d varchar(256) not null,
13 correct char(1) not null
14);
15
16CREATE TABLE IF NOT EXISTS gap_questions (
17 id int auto_increment primary key
18);
19
20CREATE TABLE IF NOT EXISTS gaps (
21 id int auto_increment primary key,
22 gap_question_id int not null,
23 foreign key(gap_question_id) references gap_questions(id),
24 content varchar(256) not null,
25 is_gap bool
26);
27
28insert into mult_choice_questions values
29 (null, 'Question content asasas?', 'a answer', 'b answer', 'c answer', 'd answer', 'a'),
30 (null, 'Question content second?', 'a aaaaanswer', 'b bbanswer', 'c ccanswer', 'd ddanswer', 'a');
31
32insert into gap_questions values
33 (null),
34 (null);
35
36insert into gaps values
37 (null, 1, 'First part', false),
38 (null, 1, 'first gap', true),
39 (null, 1, '2nd part', false),
40 (null, 1, '2nd gap', true),
41 (null, 1, 'third part', false);