Recap - Attendance
Part of the Beyond the Basics section of Coddy's SQL journey — lesson 5 of 27.
Challenge
EasyAvailable tables and columns:
<strong>attendance</strong>:<strong>student_id</strong>,<strong>present_days</strong>,<strong>total_days</strong>
For each student return student_id and a column status equal to:
'unknown'iftotal_daysis0'good'if attendance ratio is at least0.9'okay'if it's at least0.7'poor'otherwise
Use NULLIF to avoid dividing by zero. Order by student_id.
Try it yourself
SELECT student_id,
-- combine NULLIF with CASE
FROM attendance
ORDER BY student_id