ソースコード
WITH A AS (
	SELECT
		AREA_CODE
		,ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1) RATIO
		,DENSE_RANK() OVER (ORDER BY ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1)) RANK
	FROM
		HOUSEHOLD_SURVEY
	WHERE
		SURVEY_YEAR = 2022
)
, B AS (
	SELECT
		AREA_CODE
		,ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1) RATIO
		,DENSE_RANK() OVER (ORDER BY ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1)) RANK
	FROM
		HOUSEHOLD_SURVEY
	WHERE
		SURVEY_YEAR = 2017
)
, C AS (
	SELECT
		AREA_CODE
		,ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1) RATIO
		,DENSE_RANK() OVER (ORDER BY ROUND((FOOD_EXP*1.00/CONSUMPTION_EXP*1.00)*100,1)) RANK
	FROM
		HOUSEHOLD_SURVEY
	WHERE
		SURVEY_YEAR = 2012
)
SELECT
	A.AREA_CODE
	,D.AREA_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 A,B,C,AREA D
WHERE
	A.AREA_CODE = B.AREA_CODE
AND	A.AREA_CODE = C.AREA_CODE 
AND A.AREA_CODE = D.AREA_CODE
ORDER BY
	A.RANK,A.AREA_CODE DESC
;
提出情報
提出日時2023/12/18 11:02:45
コンテスト第10回 SQLコンテスト
問題食料費の割合
受験者yfuku
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量93 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
93 MB
データパターン3
WA
86 MB