GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
2
Releases
6
Issues
21
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
INFORMS2
Compare Revisions
View Page
Back to Page History
Useful queries.md
## List papers for which results are expected So that you know who to pester for results! ```sql select Paper_Code, count(*) from Enrolment inner join Paper using (Paper_Code, Year, Period_Code) where Year = YYYY and Period_Code = 'X#' and Enrolled_At_End and Visible group by Paper_Code having count(*) > 0 order by Paper_Code; ``` ## List A+ students This is handy if you want to send them a congratulations letter or similar. ```sql select Student_ID, Surname || ', ' || Othernames as Name, String_Agg( Enrolment.Paper_Code || ' (' || Result || ')', ', ' ) as Papers from Enrolment inner join Student USING ( Student_ID ) INNER JOIN Paper USING (Paper_Code, Year, Period_Code ) WHERE ( Year = 2015 ) AND ( Result >= 90 ) AND Visible GROUP BY Student_ID, Name ORDER BY Name, Student_ID; ```
## List papers for which results are expected ```sql select Paper_Code, count(*) from Enrolment where Year = YYYY and Period_Code = 'X#' and Enrolled_At_End group by Paper_Code having count(*) > 0 order by Paper_Code; ```