Skip to content

Commit 9baad69

Browse files
authored
Update create_tables.sql
1 parent 38b97af commit 9baad69

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

db/create_tables.sql

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1+
CREATE DATABASE question_db;
2+
3+
USE question_db;
4+
5+
CREATE TABLE questions (
6+
id INT AUTO_INCREMENT PRIMARY KEY,
7+
question TEXT NOT NULL,
8+
answer_type ENUM('text', 'image', 'file', 'video', 'link') NOT NULL,
9+
answer TEXT NOT NULL
10+
);
11+
12+
CREATE TABLE options (
13+
id INT AUTO_INCREMENT PRIMARY KEY,
14+
question_id INT,
15+
option_type ENUM('text', 'image', 'file', 'video', 'link') NOT NULL,
16+
option_content TEXT NOT NULL,
17+
FOREIGN KEY (question_id) REFERENCES questions(id)
18+
);
19+
20+
INSERT INTO questions (question, answer_type, answer) VALUES
21+
("Identify the famous landmark.", "text", "Eiffel Tower");
22+
23+
INSERT INTO options (question_id, option_type, option_content) VALUES
24+
(1, "text", "Eiffel Tower"),
25+
(1, "image", "images/statue_of_liberty.jpg"),
26+
(1, "video", "videos/great_wall.mp4"),
27+
(1, "link", "https://en.wikipedia.org/wiki/Taj_Mahal");
128

0 commit comments

Comments
 (0)