Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block tehmoth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6320577
SELECT name, subject, grade FROM
(SELECT student_id, subject_id, grade, RANK() OVER (PARTITION BY student_id ORDER BY grade)
FROM exams)
AS grades, students, subjects
WHERE grades.subject_id = subjects.subject_id AND grades.student_id = students.student_id
AND rank = 1 ORDER BY grade;
View gist:6320512
SELECT name, subject, grade FROM
(SELECT, subjects.subject, grade, RANK() over (PARTITION BY students.student_id ORDER BY grade) rank
FROM exams, students, subjects
WHERE exams.subject_id = subjects.subject_id AND exams.student_id = students.student_id) AS grades
WHERE rank = 1;
You can’t perform that action at this time.