コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with T2022 as (
select AREA_CODE as CODE
, rank () over ( order by round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real ) ) ,1 ) ) as 'RANK'
, round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real) ) ,1 ) || '%' as 'RATIO'
from HOUSEHOLD_SURVEY as A
where SURVEY_YEAR = '2022'
)
, T2017 as (
select AREA_CODE as CODE
, rank () over ( order by round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real ) ) ,1 ) ) as 'RANK'
, round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real) ) ,1 ) || '%' as 'RATIO'
from HOUSEHOLD_SURVEY as A
where SURVEY_YEAR = '2017'
)
, T2012 as (
select AREA_CODE as CODE
, rank () over ( order by round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real ) ) ,1 ) ) as 'RANK'
, round ( 100.0 * ( cast(FOOD_EXP as real) / cast(CONSUMPTION_EXP as real) ) ,1 ) || '%' as 'RATIO'
from HOUSEHOLD_SURVEY as A
where SURVEY_YEAR = '2012'
)
select
T2022.CODE as CODE
, ( select AREA_NAME from AREA as B where T2022.CODE = B.AREA_CODE ) as NAME
, T2022.RANK as '2022_RANK' , T2022.RATIO as '2022_RATIO'
, T2017.RANK as '2017_RANK' , T2017.RATIO as '2017_RATIO'
, T2012.RANK as '2012_RANK' , T2012.RATIO as '2012_RATIO'
from T2022 inner join T2017 on T2022.CODE = T2017.CODE
inner join T2012 on T2022.CODE = T2012.CODE
order by '2022_RANK' , T2022.CODE
提出情報
提出日時 | 2023/12/18 10:21:39 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | hmasa |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 99 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
88 MB
データパターン2
WA
99 MB
データパターン3
WA
99 MB