Skip to content

Instantly share code, notes, and snippets.

@clintonb
Created October 15, 2015 22:01
Show Gist options
  • Save clintonb/d943be4f6daa401e0613 to your computer and use it in GitHub Desktop.
Save clintonb/d943be4f6daa401e0613 to your computer and use it in GitHub Desktop.
Queries for answering credit-related questions
-- Number of students who have submitted credit requests,
-- grouped by course and status.
SELECT
co.course_key
, cr.status
, COUNT(1) AS 'count'
FROM
credit_creditrequest cr
JOIN credit_creditcourse co ON cr.course_id = co.id
GROUP BY
co.course_key
, cr.status;
-- Number of students eligible for credit, grouped by course
SELECT
co.course_key
, COUNT(1) AS 'count'
FROM
credit_crediteligibility ce
JOIN credit_creditcourse co ON ce.course_id = co.id
GROUP BY
co.course_key;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment