ソースコード
select
    H.SURVEY_YEAR,
    A.AREA_CODE as CODE,
    A.AREA_NAME as NAME,
    SUM(CASE WHEN H.SURVEY_YEAR=2022 THEN H.FOOD_EXP ELSE 0 END) as "2022_FOOD",
    SUM(CASE WHEN H.SURVEY_YEAR=2022 THEN H.CONSUMPTION_EXP ELSE 0 END) as "2022_CONSUMPTION",
    ROUND(CAST(SUM(CASE WHEN H.SURVEY_YEAR=2022 THEN H.FOOD_EXP ELSE 0 END) as float) / SUM(CASE WHEN H.SURVEY_YEAR=2022 THEN H.CONSUMPTION_EXP ELSE 0 END) * 100, 1) || "%" AS "2022_RATIO",
    ROUND(CAST(SUM(CASE WHEN H.SURVEY_YEAR=2017 THEN H.FOOD_EXP ELSE 0 END) as float) / SUM(CASE WHEN H.SURVEY_YEAR=2017 THEN H.CONSUMPTION_EXP ELSE 0 END) * 100, 1) || "%" AS "2017_RATIO",
    ROUND(CAST(SUM(CASE WHEN H.SURVEY_YEAR=2012 THEN H.FOOD_EXP ELSE 0 END) as float) / SUM(CASE WHEN H.SURVEY_YEAR=2012 THEN H.CONSUMPTION_EXP ELSE 0 END) * 100, 1) || "%" AS "2012_RATIO"
from HOUSEHOLD_SURVEY as H
inner join AREA as A
on H.AREA_CODE = A.AREA_CODE
where H.SURVEY_YEAR in (2022, 2017, 2012)
group by A.AREA_CODE;
提出情報
提出日時2023/12/15 16:50:53
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者itaku
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量98 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
98 MB
データパターン2
WA
83 MB
データパターン3
WA
85 MB