コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT AGE,
GENDER,
H_AVG,
ROUND(H_PER* 100.0 / H_CNT,1) || '%' AS H_PER,
W_AVG,
ROUND(W_PER* 100.0 / W_CNT,1) || '%' AS W_PER
FROM(SELECT S.AGE AS AGE,
CASE
WHEN S.GENDER_CODE = '20' THEN 'MALE'
WHEN S.GENDER_CODE = '30' THEN 'FEMALE'
ELSE S.GENDER_CODE
END AS GENDER,
(SELECT ROUND(AVG(AVERAGE_VALUE),1) AS AVG
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '10'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS H_AVG,
(SELECT COUNT(*)
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '10'
AND (SELECT ROUND(AVG(AVERAGE_VALUE),1) AS AVG
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '10'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) <= AVERAGE_VALUE
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS H_PER,
(SELECT COUNT(*)
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '10'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS H_CNT,
(SELECT ROUND(AVG(AVERAGE_VALUE),1)
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '20'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS W_AVG,
(SELECT COUNT(*)
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '20'
AND (SELECT ROUND(AVG(AVERAGE_VALUE),1) AS AVG
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '20'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) <= AVERAGE_VALUE
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS W_PER,
(SELECT COUNT(*)
FROM SCHOOL_HEALTH
WHERE SURVEY_YEAR = '2019'
AND AGE = S.AGE
AND GENDER_CODE = S.GENDER_CODE
AND CATEGORY_CODE = '20'
GROUP BY SURVEY_YEAR,
CATEGORY_CODE,
GENDER_CODE,
AGE
) AS W_CNT
FROM SCHOOL_HEALTH S
WHERE S.SURVEY_YEAR = '2019'
GROUP BY AGE,
GENDER_CODE
ORDER BY AGE DESC,
GENDER_CODE DESC
)
提出情報
提出日時 | 2023/08/21 11:16:07 |
コンテスト | 第8回 SQLコンテスト |
問題 | 身長と体重 |
受験者 | test |
状態 (詳細) | TLE (Time Limit Exceeded: 時間制限オーバー) |
メモリ使用量 | 99 MB |
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
99 MB
データパターン2
TLE
98 MB