-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38b97af
commit 9baad69
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
CREATE DATABASE question_db; | ||
|
||
USE question_db; | ||
|
||
CREATE TABLE questions ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
question TEXT NOT NULL, | ||
answer_type ENUM('text', 'image', 'file', 'video', 'link') NOT NULL, | ||
answer TEXT NOT NULL | ||
); | ||
|
||
CREATE TABLE options ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
question_id INT, | ||
option_type ENUM('text', 'image', 'file', 'video', 'link') NOT NULL, | ||
option_content TEXT NOT NULL, | ||
FOREIGN KEY (question_id) REFERENCES questions(id) | ||
); | ||
|
||
INSERT INTO questions (question, answer_type, answer) VALUES | ||
("Identify the famous landmark.", "text", "Eiffel Tower"); | ||
|
||
INSERT INTO options (question_id, option_type, option_content) VALUES | ||
(1, "text", "Eiffel Tower"), | ||
(1, "image", "images/statue_of_liberty.jpg"), | ||
(1, "video", "videos/great_wall.mp4"), | ||
(1, "link", "https://en.wikipedia.org/wiki/Taj_Mahal"); | ||
|