ソースコード
SELECT
AG.AGE_NAME as 年齢階層,
TPOP1.TARGET_POP1 AS "5時間未満",
TPOP2.TARGET_POP2 AS "5時間以上6時間未満",
TPOP3.TARGET_POP3 AS "6時間以上7時間未満",
TPOP4.TARGET_POP4 AS "7時間以上8時間未満",
TPOP5.TARGET_POP5 AS "8時間以上9時間未満",
TPOP6.TARGET_POP6 AS "9時間以上",
TPOP7.TARGET_POP7 AS "不詳"
FROM SLEEP_TIME_DTL AS SLDT
INNER JOIN AGE_GRP AS AG 
ON SLDT.AGE_CODE = AG.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP1 from SLEEP_TIME_DTL where TIME_CODE = '120' group by AGE_CODE) TPOP1  ON SLDT.AGE_CODE = TPOP1.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP2 from SLEEP_TIME_DTL where TIME_CODE = '130' group by AGE_CODE) TPOP2  ON SLDT.AGE_CODE = TPOP2.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP3 from SLEEP_TIME_DTL where TIME_CODE = '140' group by AGE_CODE) TPOP3  ON SLDT.AGE_CODE = TPOP3.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP4 from SLEEP_TIME_DTL where TIME_CODE = '150' group by AGE_CODE) TPOP4  ON SLDT.AGE_CODE = TPOP4.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP5 from SLEEP_TIME_DTL where TIME_CODE = '160' group by AGE_CODE) TPOP5  ON SLDT.AGE_CODE = TPOP5.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP6 from SLEEP_TIME_DTL where TIME_CODE = '170' group by AGE_CODE) TPOP6  ON SLDT.AGE_CODE = TPOP6.AGE_CODE
LEFT OUTER JOIN (select AGE_CODE,sum(TARGET_POP) as TARGET_POP7 from SLEEP_TIME_DTL where TIME_CODE = '180' group by AGE_CODE) TPOP7  ON SLDT.AGE_CODE = TPOP7.AGE_CODE
group by AG.AGE_NAME
ORDER BY AG.AGE_CODE ASC;
提出情報
提出日時2022/09/19 12:36:19
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者ksw1843
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
79 MB
データパターン2
AC
77 MB