ソースコード
WITH Rankings AS (
  SELECT
    AREA_CODE,
    AREA_NAME,
    RANK() OVER (ORDER BY FOOD_EXP / CONSUMPTION_EXP * 100) AS 2022_RANK,
    ROUND(FOOD_EXP / CONSUMPTION_EXP * 100, 2) AS 2022_RATIO,
    RANK() OVER (ORDER BY FOOD_EXP_2017 / CONSUMPTION_EXP_2017 * 100) AS 2017_RANK,
    ROUND(FOOD_EXP_2017 / CONSUMPTION_EXP_2017 * 100, 2) AS 2017_RATIO,
    RANK() OVER (ORDER BY FOOD_EXP_2012 / CONSUMPTION_EXP_2012 * 100) AS 2012_RANK,
    ROUND(FOOD_EXP_2012 / CONSUMPTION_EXP_2012 * 100, 2) AS 2012_RATIO
  FROM HOUSEHOLD_SURVEY
  WHERE SURVEY_YEAR IN (2022, 2017, 2012)
)
SELECT
  AREA_CODE AS CODE,
  AREA_NAME AS NAME,
  2022_RANK,
  CONCAT(2022_RATIO, '%') AS 2022_RATIO,
  2017_RANK,
  CONCAT(2017_RATIO, '%') AS 2017_RATIO,
  2012_RANK,
  CONCAT(2012_RATIO, '%') AS 2012_RATIO
FROM Rankings
ORDER BY 2022_RANK ASC, AREA_CODE DESC;
提出情報
提出日時2023/12/18 11:36:09
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者pickles1581
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量99 MB
メッセージ
SQLITE_ERROR: unrecognized token: "2022_RANK"
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
RE
98 MB
データパターン2
RE
98 MB
データパターン3
RE
99 MB