ソースコード
SELECT
	a.AGE_CODE as "年齢コード",
	b.AGE_NAME as "年齢階層名",
	sum_SP_TIME_5 as "5時間未満",
	sum_SP_TIME_6 as "5時間以上6時間未満",
	sum_SP_TIME_7 as "6時間以上7時間未満",
	sum_SP_TIME_8 as "7時間以上8時間未満",
	sum_SP_TIME_9 as "8時間以上9時間未満",
	sum_SP_TIME_9OVER as "9時間以上"
FROM 
	(SELECT 
		AGE_CODE,
		sum(SP_TIME_5) as sum_SP_TIME_5,
		sum(SP_TIME_6) as sum_SP_TIME_6,
		sum(SP_TIME_7) as sum_SP_TIME_7,
		sum(SP_TIME_8) as sum_SP_TIME_8,
		sum(SP_TIME_9) as sum_SP_TIME_9,
		sum(SP_TIME_9OVER) as sum_SP_TIME_9OVER
	FROM 
		SLEEP_TIME_DTL
	WHERE 
		PF_CODE IN (SELECT PF_CODE FROM PREFECTURE WHERE PF_NAME IN ("北海道","青森県","岩手県","宮城県","福島県") )
	GROUP BY
		AGE_CODE
	) as a 
inner join 
	AGE_GRP as b 
on
	a.AGE_CODE = b.AGE_CODE
ORDER BY 
	a.AGE_CODE
;
提出情報
提出日時2022/07/20 21:12:14
コンテスト第1回 SQLコンテスト
問題睡眠時間帯別集計
受験者sugusan
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量103 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
101 MB
データパターン2
AC
103 MB