コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
HS.AREA_CODE AS CODE,
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',
RANK17 AS '2017_RANK',
RATIO17 || "%" AS '2017_RATIO',
RANK12 AS '2012_RANK',
RATIO12 || "%" AS '2012_RATIO'
FROM
HOUSEHOLD_SURVEY AS HS
INNER JOIN AREA
ON AREA.AREA_CODE=HS.AREA_CODE
INNER JOIN (
SELECT
AREA_CODE,
DENSE_RANK()OVER(ORDER BY ROUND(CAST(FOOD_EXP AS REAL)/CAST(CONSUMPTION_EXP AS REAL)*100,1) ASC) AS RANK17,
ROUND(CAST(FOOD_EXP AS REAL)/CAST(CONSUMPTION_EXP AS REAL)*100,1) AS RATIO17
FROM
HOUSEHOLD_SURVEY
WHERE
SURVEY_YEAR=2017
) AS SUB17
ON SUB17.AREA_CODE=HS.AREA_CODE
INNER JOIN (
SELECT
AREA_CODE,
DENSE_RANK()OVER(ORDER BY ROUND(CAST(FOOD_EXP AS REAL)/CAST(CONSUMPTION_EXP AS REAL)*100,1) ASC) AS RANK12,
ROUND(CAST(FOOD_EXP AS REAL)/CAST(CONSUMPTION_EXP AS REAL)*100,1) AS RATIO12
FROM
HOUSEHOLD_SURVEY
WHERE
SURVEY_YEAR=2012
) AS SUB12
ON SUB12.AREA_CODE=HS.AREA_CODE
WHERE
SURVEY_YEAR=2022
ORDER BY
DENSE_RANK()OVER(ORDER BY ROUND(CAST(FOOD_EXP AS REAL)/CAST(CONSUMPTION_EXP AS REAL)*100,1) ASC) ASC,
CODE DESC
提出情報
提出日時 | 2023/12/15 15:04:07 |
コンテスト | 第10回 SQLコンテスト |
問題 | 食料費の割合 |
受験者 | honyara |
状態 (詳細) | AC (Accepted: 正答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
77 MB
データパターン3
AC
86 MB