HackerRank MySQL - The Report
You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks.
- SELECT CASE
- WHEN G.GRADE < 8 THEN NULL
- ELSE S.NAME
- END AS NAME,
- G.GRADE,
- S.MARKS
- FROM STUDENTS S
- INNER JOIN GRADES G ON S.MARKS BETWEEN G.MIN_MARK AND G.MAX_MARK
- ORDER BY G.GRADE DESC,
- NAME,
- MARKS;