ソースコード
WITH 
    tall AS (
    SELECT AVERAGE_VALUE
    FROM SCHOOL_HEALTH
    WHERE CATEGORY_CODE = '10'
    ),
    weight AS (
    SELECT AVERAGE_VALUE
    FROM SCHOOL_HEALTH
    WHERE CATEGORY_CODE = '20'
    )
    
SELECT AGE AS AGE
    ,GENDER_CODE AS GENDER
    ,AVG(tall) AS H_AVG
    ,trunc(sum(tall)::float / sum(tall::float)*100) || '%' AS H_PER
    ,AVG(weight) AS W_AVG
    ,trunc(sum(weight)::float / sum(weight::float)*100) || '%' AS W_PER
FROM SCHOOL_HEALTH
WHERE case
    when GENDER_CODE='20' then SET GENDER_CODE='MALE'
    when GENDER_CODE='30' then SET GENDER_CODE='FEMALE'
AND SURVEY_YEAR = '2019'
AND AVERAGE_VALUE
GROUP BY AGE
ORDER BY AGE DESC
    ,GENDER_CODE DESC
提出情報
提出日時2023/08/20 23:13:33
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者UY
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量82 MB
メッセージ
SQLITE_ERROR: unrecognized token: ":"
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
82 MB
データパターン2
RE
79 MB