ソースコード
with rank_2022 as(
select
    area_code 
    ,round(100.0*food_exp/consumption_exp,1) as ratio
    ,rank()over(order by round(100.0*food_exp/consumption_exp,1) ) as r
from household_survey
where survey_year = '2022'
)
,rank_2017 as(
select
    area_code 
    ,round(100.0*food_exp/consumption_exp,1) as ratio
    ,rank()over(order by round(100.0*food_exp/consumption_exp,1) ) as r
from household_survey
where survey_year = '2017'
)
,rank_2012 as(
select
    area_code 
    ,round(100.0*food_exp/consumption_exp,1) as ratio
    ,rank()over(order by round(100.0*food_exp/consumption_exp,1) ) as r
from household_survey
where survey_year = '2012'
)
select 
rank_2022.area_code as CODE
,area_name as NAME
,rank_2022.r as '2022_RANK'
,rank_2022.ratio||'%' as '2022_RATIO'
,rank_2017.r as '2017_RANK'
,rank_2017.ratio||'%' as '2017_RATIO'
,rank_2012.r as '2012_RANK'
,rank_2012.ratio||'%' as '2012_RATIO'
from rank_2022
inner join rank_2017
on rank_2022.area_code = rank_2017.area_code
inner join rank_2012
on rank_2022.area_code = rank_2012.area_code
inner join area
on area.area_code = rank_2022.area_code
order by rank_2022.r,CODE desc
提出情報
提出日時2024/06/20 10:49:15
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者HamamatsuUnagi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
83 MB
データパターン3
WA
84 MB