select
    t1.id as id,
    t1.name as name,
    t1.score as score
from
    (
        SELECT
            g.id as id,
            l.name AS name,
            g.score as score,
            DENSE_RANK() OVER (
                PARTITION BY
                    g.language_id
                ORDER BY
                    g.score DESC
                    # g.id asc
            ) AS ranking
        FROM
            grade g
            LEFT JOIN language l ON g.language_id = l.id
    ) as t1
where
    t1.ranking <= 2
order by name asc,ranking asc,id asc;