ソースコード
select  R.AREA_CODE CODE
        ,R.AREA_NAME NAME
        ,s2022.ranking as "2022_RANK"
        ,s2022.RATIO || '%' as "2022_RATIO"
        ,s2017.ranking as "2017_RANK"
        ,s2017.RATIO || '%' as "2017_RATIO"
        ,s2012.ranking as "2012_RANK"
        ,s2012.RATIO || '%' as "2012_RATIO"
  from  AREA R,
(select  h.AREA_CODE
        ,round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) RATIO
        ,DENSE_RANK() OVER (ORDER BY round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) ) ranking
  from  HOUSEHOLD_SURVEY h
 where  h.SURVEY_YEAR = '2022') s2022
 ,(select  h.AREA_CODE
        ,round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) RATIO
        ,DENSE_RANK() OVER (ORDER BY round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) ) ranking
  from  HOUSEHOLD_SURVEY h
 where  h.SURVEY_YEAR = '2017') s2017
 ,(select  h.AREA_CODE
        ,round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) RATIO
        ,DENSE_RANK() OVER (ORDER BY round(1.00 * h.FOOD_EXP * 100 / h.CONSUMPTION_EXP,1) ) ranking
  from  HOUSEHOLD_SURVEY h
 where  h.SURVEY_YEAR = '2012') s2012
 
 where  R.AREA_CODE = s2022.AREA_CODE
    and R.AREA_CODE = s2017.AREA_CODE
    and R.AREA_CODE = s2012.AREA_CODE
 order by s2022.ranking,R.AREA_CODE desc
提出情報
提出日時2023/12/17 16:29:01
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者ksw_201815
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
100 MB
データパターン2
AC
87 MB
データパターン3
AC
95 MB