DENSE_RANK()
window function to assign a rank to each student's grade, partitioned by student_id
and ordered by grade
descending and course_id
ascending.student_id
in ascending order to match the required output format.erDiagram Enrollments { int student_id int course_id int grade student_id course_id PK }