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.
- Prepare
- SQL
- Basic Join
- The Report
- Discussions
The Report
The Report
Sort by
recency
|
3601 Discussions
|
Please Login in order to post a comment
WITH REPORT AS (SELECT NAME, (SELECT GRADE FROM GRADES WHERE MARKS BETWEEN MIN_MARK AND MAX_MARK) AS GRADE, MARKS FROM STUDENTS ORDER BY GRADE DESC, NAME ASC)
SELECT CASE WHEN GRADE < 8 THEN NULL ELSE NAME END AS NAME, GRADE, MARKS FROM REPORT;
How is this one?
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
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