ソースコード

with
  s2022 as (select AREA_CODE, round(FOOD_EXP * 100.0 / CONSUMPTION_EXP, 1) as RATIO from HOUSEHOLD_SURVEY where SURVEY_YEAR = 2022)
, s2017 as (select AREA_CODE, round(FOOD_EXP * 100.0 / CONSUMPTION_EXP, 1) as RATIO from HOUSEHOLD_SURVEY where SURVEY_YEAR = 2017)
, s2012 as (select AREA_CODE, round(FOOD_EXP * 100.0 / CONSUMPTION_EXP, 1) as RATIO from HOUSEHOLD_SURVEY where SURVEY_YEAR = 2012)
select
    s2022.AREA_CODE  as CODE
  , AREA_NAME        as NAME
  , s2022.RATIO || '%'                    as "2022_RATIO"
  , rank() over(order by s2022.RATIO asc) as "2022_RANK"
  , s2017.RATIO || '%'                    as "2017_RATIO"
  , rank() over(order by s2017.RATIO asc) as "2017_RANK"
  , s2012.RATIO || '%'                    as "2012_RATIO"
  , rank() over(order by s2012.RATIO asc) as "2012_RANK"
from
  s2022
  inner join s2017 using(AREA_CODE)
  inner join s2012 using(AREA_CODE)
  inner join AREA  using(AREA_CODE)
order by 
    "2022_RANK" asc
  , AREA_CODE desc
;
提出情報
提出日時2023/12/15 12:50:43
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者kamaoda
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
89 MB
データパターン2
WA
84 MB
データパターン3
WA
84 MB