コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with TBL_2022 as (
select
AREA_CODE
, ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) as RATIO
, DENSE_RANK() OVER (
ORDER BY
ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) asc
) as RANK
from
HOUSEHOLD_SURVEY
where
SURVEY_YEAR = 2022
)
, TBL_2017 as (
select
AREA_CODE
, ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) as RATIO
, DENSE_RANK() OVER (
ORDER BY
ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) asc
) as RANK
from
HOUSEHOLD_SURVEY
where
SURVEY_YEAR = 2017
)
, TBL_2012 as (
select
AREA_CODE
, ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) as RATIO
, DENSE_RANK() OVER (
ORDER BY
ROUND(
CAST(FOOD_EXP as real) / CONSUMPTION_EXP * 100
, 1
) asc
) as RANK
from
HOUSEHOLD_SURVEY
where
SURVEY_YEAR = 2012
)
select
T22.AREA_CODE as CODE,
AREA.AREA_NAME as NAME,
T22.RANK as "2022_RANK",
T22.RATIO || '%' as "2022_RATIO",
T17.RANK as "2017_RANK",
T22.RATIO || '%' as "2017_RATIO",
T17.RANK as "2012_RANK",
T22.RATIO || '%' as "2012_RATIO"
from
TBL_2022 as T22
inner join TBL_2017 as T17
on T22.AREA_CODE = T17.AREA_CODE
inner join TBL_2012 as T12
on T22.AREA_CODE = T12.AREA_CODE
inner join AREA on T22.AREA_CODE = AREA.AREA_CODE
order by "2022_RANK" asc, AREA.AREA_CODE desc
提出情報
提出日時 | 2024/11/07 14:37:24 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | kawano |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
85 MB
データパターン3
WA
86 MB