I'm currently working on a quiz system and am trying to make the database design first. I've read some threads about different quizzes but they are all unique on some parts.
The system will use a MySQL database with PHP.
The goals of this quiz system:
- Be able to have different "quizzes" inside it
- Timetrack on the full quiz and for each question (thinking ahead for a challenge part between people)
- Be able to handle a lot of participants in the quiz
- Have a good base so it can be developed further with new, more complex functions without the need to rebuild the whole system (the database design that is).
Image of the database design so far. I've written the field on each "relationship".
I'm quite sure most of it is mostly self-explanatory, but I've added notes on the less obvious ones.
In the start at least it won't be any "live" contest. More likely that you do the quiz, get the time for it and then you can send a link to a friend and compete. But I'm still thinking a bit for that part.
I realise that with this design it's a bit more work to get the complete results etc than a basic quiz design where you put everything together in a table or two. But I try to divide it into different tables to be able to scale it better and make it more complex for later.
I'm thinking about adding some kind of support so a question can be used in different quizzes as well. Just thinking about how I should do it best.
A key feature in this is also to be able to load everything fast.
Any tip is welcome!
wp_quiz (Here we store all the different quizzes)
- quiz_site (internal thingy, nothing important for the quiz itself)
- quiz_question_multianswer (In case it's a special question that has more than one correct answer, then we use for example selects intead of radiobuttons).