Development:Quiz database structure
Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Quiz database structure.
This page documents the database tables use by the quiz module.
Quiz settings and runtime overview
It is helpful to distinguish between quiz settings, which is where we store information about how the teacher has set up the quiz, and 'runtime' (not a great name) where we store information about people's attempts at the quiz.
Note that information about the attempter's interaction with each question is stored by the question engine. See Development:Question_database_structure for details.
Quiz report tables overview
Common field types
- Fields that hold an overall score, like quiz.grade, should be NUMBER(10,5).
- Fields that hold an individual question score, like quiz_question_instances.grade, should be NUMBER(12,7).
Detailed table descriptions
In Moodle 2.0 dev, you can get these by going to Administration -> Development -> XMLDB and clicking on the [Doc] link next in any of the relevant rows (mod/quiz/db, mod/quiz/report/xxx/db). Looking directly there is much more likely to be up-to-date than relying on information that has been copied here.
(Wouldn't it be nice if that documentation was automatically build and available online.)
- New field quiz.showuserpicture. See MDL-3156.
- All the quiz report tables are new. See Development:Quiz_report_enhancements
- All fields that store grades were reviewed and set to the recommended types mentioned above.
- Never used quiz_question_versions table was removed.
- Time limit field changed to int(10).
- New table quiz_feedback.