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
|
3508 Discussions
|
Please Login in order to post a comment
MYSQL:-
select if(grade<8,NULL,name), grade, marks from students join grades where students.marks between grades.min_mark and grades.max_mark order by grade desc, name asc
SELECT CASE WHEN GRADES.GRADE >= 8 THEN STUDENTS.NAME ELSE NULL END,GRADES.GRADE,STUDENTS.MARKS FROM STUDENTS JOIN GRADES ON STUDENTS.MARKS BETWEEN GRADES.MIN_MARK AND GRADES.MAX_MARK ORDER BY GRADES.GRADE DESC, STUDENTS.NAME
/* the solution */ select case when G.Grade <8 then null else S.Name end as Name,G.Grade ,S.Marks from Students as S inner join Grades as G on S.Marks between G.Min_Mark and G.Max_Mark order by G.Grade desc,S.Name,S.Marks
SELECT CASE WHEN MARKS BETWEEN 70 AND 100 THEN NAME ELSE NULL END AS NAMES, CASE WHEN MARKS BETWEEN MIN_MARK AND MAX_MARK THEN GRADE END, MARKS FROM STUDENTS JOIN GRADES ON MARKS BETWEEN MIN_MARK AND MAX_MARK ORDER BY GRADE DESC, NAME ASC;