コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT BASE.AREA_CODE AS CODE,
M1.AREA_NAME AS NAME,
BASE.RANK AS "2022_RANK",
BASE.RATIO || '%' AS "2022_RATIO",
T1.RANK AS "2017_RANK",
T1.RATIO || '%' AS "2017_RATIO",
T2.RANK AS "2012_RANK",
T2.RATIO || '%' AS "2012_RATIO"
FROM (SELECT AREA_CODE,
RATIO,
dense_rank() over (order by RATIO) AS RANK
FROM (SELECT AREA_CODE,
ROUND(CAST(FOOD_EXP AS REAL) / CONSUMPTION_EXP * 100,1) AS RATIO
FROM HOUSEHOLD_SURVEY
WHERE SURVEY_YEAR = 2022
)
) BASE INNER JOIN AREA M1
ON BASE.AREA_CODE = M1.AREA_CODE
INNER JOIN (SELECT AREA_CODE,
RATIO,
dense_rank() over (order by RATIO) AS RANK
FROM (SELECT AREA_CODE,
ROUND(CAST(FOOD_EXP AS REAL) / CONSUMPTION_EXP * 100,1) AS RATIO
FROM HOUSEHOLD_SURVEY
WHERE SURVEY_YEAR = 2017
)
) T1
ON BASE.AREA_CODE = T1.AREA_CODE
INNER JOIN (SELECT AREA_CODE,
RATIO,
dense_rank() over (order by RATIO) AS RANK
FROM (SELECT AREA_CODE,
ROUND(CAST(FOOD_EXP AS REAL) / CONSUMPTION_EXP * 100,1) AS RATIO
FROM HOUSEHOLD_SURVEY
WHERE SURVEY_YEAR = 2012
)
) T2
ON BASE.AREA_CODE = T2.AREA_CODE
ORDER BY BASE.RANK ASC,BASE.AREA_CODE DESC
提出情報
提出日時 | 2023/12/16 21:33:16 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | yng |
状態 (詳細) | AC (Accepted: 正答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
AC
85 MB
データパターン3
AC
85 MB