コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
select * FROM
-- H_AVG
(select
AGE,
CASE WHEN GENDER_CODE = 20 THEN 'MALE' ELSE 'FEMALE' END AS GENDER,
ROUND(AVG(AVERAGE_VALUE), 1) AS H_AVG
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = 2019
AND CATEGORY_CODE = 10
GROUP BY AGE, GENDER_CODE
ORDER BY AGE DESC, GENDER_CODE DESC) AS AAA
-- H_PER
JOIN
(select
AGE,
CASE WHEN GENDER_CODE = 20 THEN 'MALE' ELSE 'FEMALE' END AS GENDER,
COUNT(
case when
AVERAGE_VALUE >= (SUM(AVERAGE_VALUE) / COUNT(AVERAGE_VALUE))
then true
else null
end
) AS H_PER
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = 2019
AND CATEGORY_CODE = 10
GROUP BY AGE, GENDER_CODE
ORDER BY AGE DESC, GENDER_CODE DESC) AS AAA_1
ON AAA.AGE = AAA_1.AGE
AND AAA.GENDER = AAA_1.GENDER
-- W_AVG
JOIN
(select
AGE,
CASE WHEN GENDER_CODE = 20 THEN 'MALE' ELSE 'FEMALE' END AS GENDER,
ROUND(AVG(AVERAGE_VALUE), 1) AS W_AVG
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = 2019
AND CATEGORY_CODE = 20
GROUP BY AGE, GENDER_CODE
ORDER BY AGE DESC, GENDER_CODE DESC) AS BBB
ON AAA.AGE = BBB.AGE
AND AAA.GENDER = BBB.GENDER
提出情報
提出日時 | 2023/08/19 08:07:04 |
コンテスト | 第8回 SQLコンテスト |
問題 | 身長と体重 |
受験者 | KakiageSeiro |
状態 (詳細) | RE (Runtime Error: 実行時エラー) |
メモリ使用量 | 79 MB |
メッセージ
SQLITE_ERROR: misuse of aggregate function COUNT()
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
76 MB
データパターン2
RE
79 MB