요약 - 출석
Coddy SQL 여정의 심화 과정 섹션에 포함된 레슨 — 27개 중 5번째.
챌린지
쉬움사용 가능한 테이블 및 컬럼:
<strong>attendance</strong>:<strong>student_id</strong>,<strong>present_days</strong>,<strong>total_days</strong>
각 학생에 대해 student_id와 다음 조건에 따른 status 컬럼을 반환하세요:
total_days가0인 경우'unknown'- 출석률이 최소
0.9인 경우'good' - 최소
0.7인 경우'okay' - 그 외의 경우
'poor'
0으로 나누는 것을 방지하기 위해 NULLIF를 사용하세요. student_id를 기준으로 정렬하세요.
직접 해보기
SELECT student_id,
-- NULLIF와 CASE를 결합
FROM attendance
ORDER BY student_id