The Report

  • + 1 comment

    After Submitting the problem , I found that there is table named Grade in this Question .

    Anyways My Solution -

    SELECT CASE WHEN MarksSegmentation = 8 THEN name WHEN MarksSegmentation = 9 THEN name WHEN MarksSegmentation = 10 THEN name ELSE NULL

    END NameSegmentation, MarksSegmentation,marks  
    

    from (

    SELECT name , CASE WHEN MARKS >= 0 and MARKS <=9 THEN 1 WHEN MARKS >=10 and MARKS <=19 THEN 2 WHEN MARKS >=20 and MARKS <=29 THEN 3 WHEN MARKS >=30 and MARKS <=39 THEN 4 WHEN MARKS >=40 and MARKS <=49 THEN 5 WHEN MARKS >=50 and MARKS <=59 THEN 6 WHEN MARKS >=60 and MARKS <=69 THEN 7 WHEN MARKS >=70 and MARKS <=79 THEN 8 WHEN MARKS >=80 and MARKS <=89 THEN 9 WHEN MARKS >=90 and MARKS <=100 THEN 10

    END MarksSegmentation , marks from Students ) as Sub_query
    
    ORDER BY MarksSegmentation DESC ,name;