The Report

  • + 0 comments

    For both cases your order by statement is the same.. As in when grades<8 then you order by grade, then name and then marks. However the question states to order by grade, then marks, when grades<8 And in the next case it states to order by grade and then by name. I guess its due to the clarity Here's my code:

    select s.name, g.grade, s.marks from students s left join grades g on s.marks between g.min_mark and g.max_mark where g.grade>=8 order by g.grade desc, s.name asc;

    select NULL, g.grade, s.marks from students s left join grades g on s.marks between g.min_mark and g.max_mark where g.grade<8 order by g.grade desc, s.marks asc;