Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
230 B
1
Indexable
Never
SELECT
IF (grade >= 8, name, NULL), grade, marks
FROM
(SELECT 
name,
(SELECT grade FROM grades WHERE (min_mark <= marks) AND (marks <= max_mark)) AS grade,
marks 
FROM students)
AS studentgrades
ORDER BY grade DESC, name;