コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with COMP_DATA AS (
SELECT *
FROM
SLEEP_TIME_DTL AS data
LEFT JOIN SLEEP_TIME AS time
ON data.TIME_CODE = time.TIME_CODE
LEFT JOIN AGE_GRP AS age
ON data.AGE_CODE = age.AGE_CODE
)
SELECT
AGE_NAME AS '年齢階層',
SUM(t.less_5hours) AS '5時間未満',
SUM(t.less_6hours) AS '5時間以上6時間未満',
SUM(t.less_7hours) AS '6時間以上7時間未満',
SUM(t.less_8hours) AS '7時間以上8時間未満',
SUM(t.less_9hours) AS '8時間以上9時間未満',
SUM(t.up_to_9hours) AS '9時間以上',
SUM(t.undef) AS '不詳'
FROM (
SELECT
AGE_NAME,
AGE_CODE,
CASE WHEN COMP_DATA.TIME_CODE = 120 THEN TARGET_POP ELSE 0 END AS less_5hours,
CASE WHEN COMP_DATA.TIME_CODE = 130 THEN TARGET_POP ELSE 0 END AS less_6hours,
CASE WHEN COMP_DATA.TIME_CODE = 140 THEN TARGET_POP ELSE 0 END AS less_7hours,
CASE WHEN COMP_DATA.TIME_CODE = 150 THEN TARGET_POP ELSE 0 END AS less_8hours,
CASE WHEN COMP_DATA.TIME_CODE = 160 THEN TARGET_POP ELSE 0 END AS less_9hours,
CASE WHEN COMP_DATA.TIME_CODE = 170 THEN TARGET_POP ELSE 0 END AS up_to_9hours,
CASE WHEN COMP_DATA.TIME_CODE = 180 THEN TARGET_POP ELSE 0 END AS undef
FROM
COMP_DATA
) AS t
GROUP BY AGE_CODE
ORDER BY AGE_CODE ASC
;
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
AC
79 MB