SQL 为 Moodle 课程中的所有多项选择题设置编号样式的语句

SQL statement to set numbering style for all multiple choice questions in a Moodle course

我正在寻找 SQL 语句来删除 Moodle 问题类别中所有多项选择题的选项编号。

(针对课程或类别中的所有问题,将 "Number the choices?" 从 "a.,b.,c.,.." 更改为 "No numbering"。)

如有任何帮助,我们将不胜感激。

只是一个猜测,但可能是这样的,不过在你做任何事情之前先备份

UPDATE mdl_question_multichoice
SET answernumbering = 'none'
WHERE answernumbering = '123';

我在 Moodle 开发者论坛上问了同样的问题,并从 Stuart Mealor 和 Tim Hunt (Moodle in English: Useful SQL Queries?) 那里得到了答案。简而言之,就是:

UPDATE mdl_qtype_multichoice_options
SET answernumbering = 'none'
WHERE questionid IN (SELECT id FROM mdl_question WHERE category = 123)

table 和字段名称可能取决于 Moodle 版本。在 2.5.9 中,以下语句对我有用:

UPDATE mdl_question_multichoice
SET answernumbering = 'none'
WHERE question IN
    (SELECT id FROM mdl_question
     WHERE category = 7);