Common SQL Queries

Get username and email from order number
select au.username, au.email, sco.id
from auth_user as au
join shoppingcart_order as sco
on sco.user_id = au.id
where sco.id in (<order_number_1>, <order_number_2>, ...)
Get problems student looked at/attempted in a course
select csm.*
from courseware_studentmodule as csm
join auth_user as au
on au.id = csm.user_id
where csm.module_type="problem"
and au.username="<username>"
and csm.course_id="<course_id>"

See Recent Grading Tasks
select *
from instructor_task_instructortask
where task_type="grade_course"
order by id desc
Find particular instructor task
select *
from `instructor_task_instructortask`
where task_id = <task_id>
Courses with html certs enabled but no cert activated
select id from course_overviews_courseoverview
where has_any_active_web_certificate = 0
and cert_html_view_enabled = 1
Courses with html certs enabled
select id from course_overviews_courseoverview
where cert_html_view_enabled = 1