문제
정답
WITH Ranks AS (
SELECT *, RANK() OVER(
PARTITION BY student_id
ORDER BY grade DESC
) as 'rank'
FROM Enrollments
)
# SELECT Enrollments.*
# FROM Enrollments, Ranks
SELECT student_id, MIN(course_id) as course_id, grade
FROM Ranks
WHERE Ranks.rank = 1
GROUP BY student_id