コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
WITH RATIO_17 AS (
SELECT
AREA_CODE
,RANK() OVER (ORDER BY ROUND((CAST(FOOD_EXP AS REAL) / CAST(CONSUMPTION_EXP AS REAL)) * 100, 1)) AS RANK_2017
,ROUND((CAST(FOOD_EXP AS REAL) / CAST(CONSUMPTION_EXP AS REAL)) * 100, 1) || '%' AS RATIO_2017
FROM
HOUSEHOLD_SURVEY
WHERE
SURVEY_YEAR = 2017
)
,RATIO_12 AS (
SELECT
AREA_CODE
,RANK() OVER (ORDER BY ROUND((CAST(FOOD_EXP AS REAL) / CAST(CONSUMPTION_EXP AS REAL)) * 100, 1)) AS RANK_2012
,ROUND((CAST(FOOD_EXP AS REAL) / CAST(CONSUMPTION_EXP AS REAL)) * 100, 1) || '%' AS RATIO_2012
FROM
HOUSEHOLD_SURVEY
WHERE
SURVEY_YEAR = 2012
)
SELECT
HS.AREA_CODE AS CODE
,A.AREA_NAME AS NAME
,RANK() OVER (ORDER BY ROUND((CAST(HS.FOOD_EXP AS REAL) / CAST(HS.CONSUMPTION_EXP AS REAL)) * 100, 1), HS.AREA_CODE DESC) AS '2022_RANK'
,ROUND((CAST(HS.FOOD_EXP AS REAL) / CAST(HS.CONSUMPTION_EXP AS REAL)) * 100, 1) || '%' AS '2022_RATIO'
,RATIO_17.RANK_2017 AS '2017_RANK'
,RATIO_17.RATIO_2017 AS '2017_RATIO'
,RATIO_12.RANK_2012 AS '2012_RANK'
,RATIO_12.RATIO_2012 AS '2012_RATIO'
FROM
HOUSEHOLD_SURVEY AS HS
LEFT OUTER JOIN
AREA AS A
ON
HS.AREA_CODE = A.AREA_CODE
INNER JOIN
RATIO_17
ON
HS.AREA_CODE = RATIO_17.AREA_CODE
INNER JOIN
RATIO_12
ON
HS.AREA_CODE = RATIO_12.AREA_CODE
WHERE
SURVEY_YEAR = 2022;
提出情報
提出日時 | 2025/01/10 15:33:04 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | fffhiro |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
86 MB
データパターン3
WA
85 MB