The Report

Sort by

recency

|

3338 Discussions

|

  • + 0 comments
    SELECT
        CASE
            WHEN g.grade < 8 THEN NULL
            ELSE s.name
        END AS student_name,
        g.grade,
        s.marks
    FROM students s
    JOIN
        grades g
    ON
        s.marks BETWEEN g.min_mark AND g.max_mark
    ORDER BY
        g.grade DESC,
        CASE
            WHEN g.grade >= 8 THEN s.name
            ELSE s.marks
        END ASC;
    
  • + 0 comments
    SELECT 
        CASE WHEN G.grade >= 8 
            THEN S.name
            ELSE "NULL"
        END,
        G.grade, 
        S.marks 
    FROM STUDENTS as S
    JOIN GRADES as G ON 
        S.marks >= G.min_mark AND 
        S.marks <= G.max_mark
    ORDER BY 
        G.grade DESC, 
        S.name ASC, 
        S.marks;
    
  • + 0 comments

    SELECT IF(grade<8,NULL,name), grade, s.marks FROM students AS s JOIN Grades AS g WHERE s.marks BETWEEN g.Min_Mark AND g.Max_Mark ORDER BY grade DESC, name ASC;

  • + 0 comments

    with cte and union

    with markwise_grade as( SELECT s.id,s.name,s.marks,g.grade from students s inner join grades g on s.marks>=min_mark and s.marks<=max_mark ), top_grade as( select markwise_grade.name as name,markwise_grade.grade,markwise_grade.marks from markwise_grade where markwise_grade.grade>=8 ), low_grade as( select "NULL" as name,markwise_grade.grade,markwise_grade.marks from markwise_grade where markwise_grade.grade<8) select * from top_grade union all select * from low_grade order by grade desc,name,marks

  • + 0 comments

    select case when s.marks > 69 then s.name else null end as name_edited, g.grade, s.marks from students as s left join grades as g on s.marks between g.min_mark and g.max_mark order by g.grade desc, s.name, s.marks ;