Created
January 26, 2022 11:03
-
-
Save Abuton/75834eb18c8c00bf31c7c2119327cedc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- write your code in PostgreSQL 9.4 | |
SELECT r.task_id, t.name as task_name, | |
case when avg(r.score) <= 20 then 'Hard' | |
when avg(r.score) > 20 and avg(score) <= 60 then 'Medium' | |
when avg(r.score) > 60 then 'Easy' End As difficulty | |
from reports r left join tasks t on r.task_id = t.id | |
group by r.task_id, task_name order by r.task_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment