2
People I have the following scenario in the database:
Tables:
mdl_question_attempts (slot, questionid, rightanswer, responsesummary)
mdl_quiz_slots (slot, quizid, questionid)
On the table mdl_question_attempts
attempts to respond to a particular quiz are recorded. questionid
is the id
of the issue, rightanswer
is the correct answer, responsesummary
is the answer given by the student.
On the table mdl_quiz_slots
the questions that were applied to the students are recorded, where questionid
is the id
of the issue, quizid
is the id
of the questionnaire (set of questions).
I would like to have the average hit for a certain quiz.
What is the format of each field?
rightanswer
would be aboolean
?– Leonardo Pessoa
Average with mysql avg() command
– Renato Junior
@RORSCHACH is unclear if he wants to average some grade. It seems to me that he wants to know how many times the question has been answered correctly on the total of times answered.
– Leonardo Pessoa
@Leonardoperson for each correct answer can be considered as positive value 1, the formats rightanswer and responsesummary is text, to know if it is correct should be considered only the lines where rightanswer = responsesummary, and responsesumarry is different from NULL
– Miguel Silva
@Leonardopessoa is just that, how many times the question has been answered correctly on the total of times the question has been answered. I think that I would have the media of every question, that?
– Miguel Silva
The formula is in this question: https://answall.com/a/236471/64969 ; it is not in SQL, but gives the general idea of how to proceed. Just calculate the total of individuals / individuals of given group
– Jefferson Quesado
@Jeffersonquesado I think the problem is a little more complex, I’m not a professional programmer so my difficulty. I can make the general media of the quiz (all questions) my difficulty is how to make the average by question, leading in cosnideration that a quiz can have different amounts of questions. this amount is obtained in the table mdl_quiz_slots where the quiz questions are registered
– Miguel Silva
The modeling is the same: count individuals of the total population, count individuals who satisfy a certain condition, divide the second by the first.
– Jefferson Quesado
my difficulty is in getting the result by question
– Miguel Silva
Vdd dvd, you’re right, I’ll have to see how I can differentiate the questionnaires.
– Miguel Silva