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