Page History

Useful queries

Nigel Stanger edited this page 15 days ago

Clone this wiki locally

List papers for which results are expected

So that you know who to pester for results!

select Paper_Code, count(*)
    Enrolment inner join
    Paper using (Paper_Code, Year, Period_Code)
    Year = YYYY and
    Period_Code = 'X#' and
    Enrolled_At_End and
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.

    Student_ID, Surname || ', ' || Othernames as Name,
    String_Agg(Enrolment.Paper_Code || ' (' || Result || ')', ', ') as Papers
    Enrolment inner join
    Student using (Student_ID) inner join
    Paper using (Paper_Code, Year, Period_Code )
where Year = YYYY
  and Result >= 90
  and Visible
group by Student_ID, Name
order by Name, Student_ID;