ソースコード
SELECT
    AGE,
    CASE GENDER_CODE
        WHEN '20' THEN 'MALE'
        WHEN '30' THEN 'FEMALE'
    END AS GENDER,
    ROUND(AVG(CASE WHEN CATEGORY_CODE = '10' THEN AVERAGE_VALUE END), 2) AS H_AVG,
    ROUND(AVG(CASE WHEN CATEGORY_CODE = '20' THEN AVERAGE_VALUE END), 2) AS W_AVG,
    ROUND(SUM(CASE WHEN CATEGORY_CODE = '10' AND AVERAGE_VALUE >= H_AVG THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) over AS H_PER,
    ROUND(SUM(CASE WHEN CATEGORY_CODE = '20' AND AVERAGE_VALUE >= W_AVG THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) over AS W_PER
FROM
    SCHOOL_HEALTH
WHERE
    SURVEY_YEAR = 2019
GROUP BY
    AGE,
    GENDER_CODE
ORDER BY
    AGE DESC,
    GENDER_CODE DESC;
提出情報
提出日時2023/08/18 14:56:16
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者be-yan
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量103 MB
メッセージ
SQLITE_ERROR: near "AS": syntax error
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
97 MB
データパターン2
RE
103 MB