Skip to content

Commit

Permalink
Update create_tables.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
mah-shamim authored Jul 27, 2024
1 parent 38b97af commit 9baad69
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions db/create_tables.sql
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");

0 comments on commit 9baad69

Please sign in to comment.