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.
**Solution is without using JOIN
**
WITH GRADES AS (SELECT *,
CASE WHEN Marks<=89 THEN FLOOR(cast((Marks/10) as decimal(10,2)))+1
ELSE 10 END GRADE
FROM STUDENTS)
SELECT
CASE WHEN GRADES.GRADE >=8 THEN NAME ELSE "NULL" END, GRADE, MARKS
FROM GRADES
ORDER BY GRADE DESC, NAME, MARKS
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 →
**Solution is without using JOIN ** WITH GRADES AS (SELECT *, CASE WHEN Marks<=89 THEN FLOOR(cast((Marks/10) as decimal(10,2)))+1 ELSE 10 END GRADE
FROM STUDENTS) SELECT CASE WHEN GRADES.GRADE >=8 THEN NAME ELSE "NULL" END, GRADE, MARKS FROM GRADES ORDER BY GRADE DESC, NAME, MARKS