Created
June 14, 2013 15:40
-
-
Save mikebuchanon/5782830 to your computer and use it in GitHub Desktop.
Find Moodle quiz questions and answer texts that contain the word 'angel'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --find all moodle questions that have the term ANGEL in their text | |
| SELECT t.shortname, | |
| t.quiz_name, | |
| mques.name "question_name", | |
| replace(replace(mques.questiontext,'<','<'),'>','>') "question_text" | |
| FROM | |
| (SELECT mc.shortname, | |
| mq.name "quiz_name", | |
| regexp_split_to_table(mq.questions,',')::integer "question_id" | |
| FROM mdl_course mc | |
| JOIN mdl_quiz mq ON mq.course=mc.id | |
| WHERE mc.category=1 and mq.questions is not null and mq.questions != '') t | |
| JOIN mdl_question mques ON t.question_id=mques.id | |
| WHERE mques.questiontext ILIKE '%angel%'; | |
| --find all moodle question answers that have the term ANGEL in their text | |
| SELECT t.shortname, | |
| t.quiz_name, | |
| mques.name "quesiton_name", | |
| replace(replace(mqa.answer,'<','<'),'>','>') "answer_text" | |
| FROM | |
| (SELECT mc.shortname, | |
| mq.name "quiz_name", | |
| regexp_split_to_table(mq.questions,',')::integer "question_id" | |
| FROM mdl_course mc | |
| JOIN mdl_quiz mq ON mq.course=mc.id | |
| WHERE mc.category=1 and mq.questions is not null and mq.questions != '') t | |
| JOIN mdl_question mques ON mques.id=t.question_id | |
| JOIN mdl_question_answers mqa ON mqa.question=mques.id | |
| WHERE mqa.answer ILIKE '%angel%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment