We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
select case when grade>=8 then name else null end as name ,grade , marks from
( select s.*,g.grade
from students s
join grades g
where s.marks between g.min_mark and g.max_mark) s
order by
grade desc,
case when grade between 8 and 10 then name else null end ,
case when grade < 8 then marks else null end
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Report
You are viewing a single comment's thread. Return to all comments →
MySql Solution:
select case when grade>=8 then name else null end as name ,grade , marks from ( select s.*,g.grade from students s join grades g where s.marks between g.min_mark and g.max_mark) s order by grade desc, case when grade between 8 and 10 then name else null end , case when grade < 8 then marks else null end