The Report

Sort by

recency

|

3234 Discussions

|

  • + 0 comments

    SELECT CASE WHEN G.Grade > 7 THEN S.Name ELSE 'NULL' END, G.Grade, S.Marks FROM STUDENTS S LEFT JOIN Grades G ON S.Marks BETWEEN G.Min_Mark AND G.Max_Mark ORDER BY G.Grade DESC, CASE WHEN G.Grade > 7 THEN S.Name ELSE S.Marks END ASC

  • + 0 comments

    select case when (select grade from grades where s.marks between min_mark and max_mark)>= 8 Then s.name else NULL end, (select grade from grades where s.marks between min_mark and max_mark) as grade_of_student, s.marks from students s order by grade_of_student desc, name asc, marks asc;

  • + 0 comments

    Pertinent to MS SQL SERVER, the compact T-SQL solution is as follows:

    SELECT NAME, GRADE, MARKS FROM STUDENTS INNER JOIN GRADES ON MARKS >=MIN_MARK AND MARKS<=MAX_MARK WHERE GRADE>7
    ORDER BY GRADE DESC, NAME
    SELECT NULL AS NAME, GRADE, MARKS FROM STUDENTS INNER JOIN GRADES ON MARKS >=MIN_MARK AND MARKS<=MAX_MARK WHERE GRADE<8 ORDER BY GRADE DESC, MARKS
    
  • + 0 comments

    -- MS SQL Server

    select name = case when grade < 8 then null else name end, grade, marks from students, grades where students.marks >= grades.min_mark and students.marks <= grades.max_mark order by grade desc, name, marks

  • + 0 comments

    WITH Full_Table AS( SELECT s.name AS name,g.grade AS grade,s.marks AS marks FROM Students s INNER JOIN Grades g ON s.marks BETWEEN g.Min_Mark AND g.Max_Mark )

    SELECT (CASE WHEN grade>=8 THEN name ELSE null END), grade, marks FROM Full_Table ORDER BY grade DESC, name;