コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
WITH RANKING2022 AS (
SELECT
2022
, a.AREA_CODE AS CODE
, AREA_NAME AS NAME
, ROUND(CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100, 2) AS RATIO
, DENSE_RANK() OVER (ORDER BY CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100 DESC) AS RANK
FROM
HOUSEHOLD_SURVEY a
INNER JOIN AREA b ON
a.AREA_CODE = b.AREA_CODE
WHERE
SURVEY_YEAR = 2022
),
RANKING2017 AS (
SELECT
2017
, a.AREA_CODE AS CODE
, AREA_NAME AS NAME
, ROUND(CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100, 2) AS RATIO
, DENSE_RANK() OVER (ORDER BY CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100 DESC) AS RANK
FROM
HOUSEHOLD_SURVEY a
INNER JOIN AREA b ON
a.AREA_CODE = b.AREA_CODE
WHERE
SURVEY_YEAR = 2017
),
RANKING2012 AS (
SELECT
2012
, a.AREA_CODE AS CODE
, AREA_NAME AS NAME
, ROUND(CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100, 2) AS RATIO
, DENSE_RANK() OVER (ORDER BY CAST(FOOD_EXP AS FLOAT) / CONSUMPTION_EXP * 100 DESC) AS RANK
FROM
HOUSEHOLD_SURVEY a
INNER JOIN AREA b ON
a.AREA_CODE = b.AREA_CODE
WHERE
SURVEY_YEAR = 2012
)
SELECT
a.CODE
, a.NAME
, a.RANK AS '2022_RANK'
, a.RATIO AS '2022_RATIO'
, b.RANK AS '2017_RANK'
, b.RATIO AS '2017_RATIO'
, c.RANK AS '2012_RANK'
, c.RATIO AS '2012_RATIO'
FROM
RANKING2022 a
LEFT JOIN RANKING2017 b ON
a.CODE = b.CODE
LEFT JOIN RANKING2012 c ON
a.CODE = c.CODE
ORDER BY
a.CODE DESC
;
提出情報
提出日時 | 2024/02/09 11:45:48 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | SQL2022 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 85 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
84 MB
データパターン3
WA
85 MB