user2851347
user2851347

Reputation: 91

Best Approach for Storing Huge Amount of Data

I am working on a quizzing project where each user will be given questions based on the category they choose. There will be a lot of questions in each data set. Each user will get a randomized pattern of the questions generated. The server needs to track of what questions the user has answered and what are left. The user can switch category anytime and come back later to the previous category. He can answer the questions he didn't answer, but he won't be able to answer the ones that he has already answered (correct or wrong) What is the best approach for this?

1)Should the questions be stored in tables, each category will have a table for it. The problem with this approach is to:

a) Keep track of what questions the user has already answered. I can have a data structure for that, but then also everytime the user asks for another question or question from different category, the query would have to ensure that it doesn't return a question he has already answered

2) The questions should be hardcoded in data structures

Upvotes: 0

Views: 52

Answers (1)

Rick James
Rick James

Reputation: 142298

One table per category - NO. Instead, a column with category_id.

Tables: Categories, Questions, Users, Responses (user_id, question_id, response, etc)

Upvotes: 1

Related Questions