Quiz App - Database Design

Hey!

I am working on a new app. I have almost all the DB Design done. I need some help with few points. Docker - MariaDB - NodeJS - Framework 7
In thw quiz will be questions of 2 options and 4 options.

  1. How can I indicate to user which quizzes they have done(Like courses apps. When you finish a class, that class is marked with a checkbox.)

  2. How can I show at the end of each quiz the rigth and wrong answers.

Cheers

You probably want a table that has user.id, quiz.id and completion_date at a bare minimum.

You already have that info available to you in que quizQuestionChoice table right?

The first one I am not sure what you mean.

The second one.

I am not sure what you mean.

I mean, that apears at the end of the quiz(7 right, 3 wrong).

Cheers

I thought you were referring to the database design. But it seems you actually want to know how to implement all that from a frontend and backend perspective.

Your questions are too broad to be able to give a quick straight answer. Where are you at right now? Do you have anything implemented?

Is related to database design. I only want to know if I have to add some extra table to make work that.

What don't you understand from that?

That should be rephrased as the "amount of right and wrong answers" as your question can be interpreted as showing which are the correct and wrong answers.

Coming back to this question. Do you want to store that info as history log in the database or do you just want to show a quick summary and not store results in database?

Is the first time I am working with database design. Something are dificult to understand.

I would like to store it. Because in the future I would like to add a option to do the quizzes you did wrong. Or make quizzes from wrong questions.

Cheers

If you want to have records per user of the quizzes you would at least need to store in a new table the user id, the quiz id and when they completed the quiz.

You could use that same table to store the wrong answers(if it’s not wrong it’s correct).

So you would have a table called completed_quizes or similar with the following fields:

quiz_id - integer - i.e. 345
user_id - integer - i.e 234324
completion_date - timestamp - i.e 2021-05-17 15:05:04
wrong_answers - string (comma separated) - i.e. 3,7,12

This is just one simple approach.