Segue o comando SQL que extrai a lista geral dos quiz criados em todos os cursos do Moodle:
SELECT q.id,q.name,q.timeopen,q.timeclose,c.id AS courseid,c.fullname AS coursename,ct.id AS courescatid,ct.name AS coursecatname, (SELECT COUNT(DISTINCT userid) FROM mdl_quiz_grades WHERE quiz=q.id) AS countuserresponse,(SELECT AVG(grade) FROM mdl_quiz_grades WHERE quiz=q.id) AS avggrade,(SELECT COUNT(DISTINCT rs.userid) AS coutrecord FROM mdl_role_assignments rs INNER JOIN mdl_context e ON rs.contextid=e.id WHERE e.contextlevel=50 AND e.instanceid =q.course AND rs.roleid IN (SELECT value FROM mdl_config WHERE name = 'gradebookroles')) AS countcourseenrol FROM mdl_quiz q INNER JOIN mdl_course c ON q.course=c.id INNER JOIN mdl_course_categories ct ON c.category=ct.id
O resultado desse comando mostra a lista dos questionários, quantidade de resposta e média para cada questionário. Além disso, exibe quantidade de alunos inscritos no curso. Isso permite calcular percentagem dos alunos que já responderam o questionário.