ソースコード
SELECT AGE, 
CASE WHEN GENDER_CODE == 20 THEN "MALE"
    ELSE "FEMALE"
END AS GENDER, 
ROUND(AVG(CASE WHEN CATEGORY_CODE = 10 THEN AVERAGE_VALUE END), 1) AS H_AVG,
ROUND(100 * COUNT(CASE   
    WHEN CATEGORY_CODE = 10 AND AVERAGE_VALUE >= (SELECT AVG(AVERAGE_VALUE) FROM SCHOOL_HEALTH WHERE CATEGORY_CODE = 10 AND SURVEY_YEAR = 2019)   
    THEN 1.0 ELSE NULL END) / COUNT(CASE WHEN CATEGORY_CODE = 10 THEN 1 END), 1) AS H_PER,  
ROUND(AVG(CASE WHEN CATEGORY_CODE = 20 THEN AVERAGE_VALUE END), 1) AS W_AVG,
ROUND(100 * AVG(CASE WHEN CATEGORY_CODE = 20 AND AVERAGE_VALUE >= (SELECT AVG(AVERAGE_VALUE) FROM SCHOOL_HEALTH WHERE CATEGORY_CODE = 20 AND SURVEY_YEAR = 2019) THEN 1.0 ELSE 0.0 END), 1) AS W_PER  
FROM SCHOOL_HEALTH 
WHERE SURVEY_YEAR = 2019
GROUP BY AGE, GENDER_CODE
ORDER BY AGE DESC, GENDER_CODE DESC
提出情報
提出日時2023/08/20 23:41:51
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者masa_aa
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
92 MB