MySql Order By Group
SELECT
course_id,
student_name,
score,
ROW_NUMBER() OVER (PARTITION BY course_id ORDER BY score DESC) AS row_num
FROM
student_scores;
SELECT
course_id,
student_name,
score,
ROW_NUMBER() OVER (PARTITION BY course_id ORDER BY score DESC) AS row_num
FROM
student_scores;