Menu
Coddy logo textTech

Recap - Attendance

Part of the Beyond the Basics section of Coddy's SQL journey — lesson 5 of 27.

challenge icon

Challenge

Easy

Available 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' if total_days is 0
  • 'good' if attendance ratio is at least 0.9
  • 'okay' if it's at least 0.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

All lessons in Beyond the Basics