Quiz Attempts Table Schema (quiz_attempts)


Stores users attempts at quizzes.

quiz_attempts table columns

Column Type Size Nulls Auto Default Children Parents Comments
id BIGINT 19 null

Standard Moodle primary key.

quiz BIGINT 19 0
quiz.id quizatte_qui2_fk R

Foreign key reference to the quiz that was attempted.

userid BIGINT 19 0
user.id quizatte_use2_fk R

Foreign key reference to the user whose attempt this is.

attempt MEDIUMINT 7 0

Sequentially numbers this student's attempts at this quiz.

uniqueid BIGINT 19 0

Foreign key reference to the question_usage that holds the details of the the question_attempts that make up this quiz attempt.

layout LONGTEXT 2147483647 null
currentpage BIGINT 19 0
preview SMALLINT 5 0
state VARCHAR 16 inprogress

The current state of the attempts. 'inprogress', 'overdue', 'finished' or 'abandoned'.

timestart BIGINT 19 0

Time when the attempt was started.

timefinish BIGINT 19 0

Time when the attempt was submitted. 0 if the attempt has not been submitted yet.

timemodified BIGINT 19 0

Last modified time.

timemodifiedoffline BIGINT 19 0

Last modified time via web services.

timecheckstate BIGINT 19 0

Next time quiz cron should check attempt for state changes. NULL means never check.

sumgrades DECIMAL 10,5 null

Total marks for this attempt.

Table contained -1 rows

quiz_attempts table indexes

Constraint Name Type Sort Column(s)
PRIMARY Primary key Asc id
quizatte_qui_ix Performance Asc quiz
quizatte_quiuseatt_uix Must be unique Asc/Asc/Asc quiz + userid + attempt
quizatte_statim_ix Performance Asc/Asc state + timecheckstate
quizatte_uni_uix Must be unique Asc uniqueid
quizatte_use_ix Performance Asc userid

quiz_attempts table relationships