I am working on a multiple choice question form. I am using Flask on the back-end and MySQL 5.7 as a database.
- There will be more than 1 end-user. I already made a users table but haven’t work on it yet
- There are multiple questions but I only display one question at once.
- Every question have either 3 or 4 possible choices (A, B, C or A, B, C, D)
- There is always one correct answer
- The user can filter question based on category and get stats by category (% of question answered for this category for example)
Should I create a new table called category
which would look like category_id (int, primary_key), category_text (varchar(50))
?
CREATE TABLE `questions` ( `question_id` int NOT NULL AUTO_INCREMENT, `contributor_id` int NOT NULL, `question_text` varchar(1000) NOT NULL, `category` varchar(50) NOT NULL, `answer_a` varchar(200) NOT NULL, `answer_b` varchar(200) NOT NULL, `answer_c` varchar(200) NOT NULL, `answer_d` varchar(200) DEFAULT NULL, `correct_answer` varchar(20) NOT NULL, PRIMARY KEY (`question_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;