Not passed yet
- O(log n) · Easy
- Free
- SQL
- conditionals
- nulls
Problem
The term is ending, and the school secretary is putting together the list of everything that hasn't been passed yet, so the families can be told. Grades go from 0 to 10. A 6 passes. A grade below that gets Retake. And an exam the teacher hasn't graded yet isn't a zero: it hasn't been passed either, but its notice is Pending.
Work from grades and show student_id, course_id, and the notice, in that order. Anything already passed stays off the list.
What it has to return
These rows, in any order
| student_id | course_id | notice |
|---|---|---|
| 3 | 1 | Retake |
| 4 | 3 | Pending |
| 6 | 1 | Retake |
This is what comes out with the data in the practice database this challenge uses. The column names don’t count, so name yours however you like: what counts is how many there are and the order they come in. Besides this one, the challenge has hidden tests with other data that are revealed when you submit your solution.
You start with this
SQL
SELECT student_id, course_id
FROM grades
WHERE grade < 6It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.