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