コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with a as (select CATEGORY_CODE, GENDER_CODE, AGE, round(avg(AVERAGE_VALUE)+0.0001, 1) as AVGV, avg(AVERAGE_VALUE) as AVGVT
from SCHOOL_HEALTH
where SURVEY_YEAR = 2019
group by CATEGORY_CODE, GENDER_CODE, AGE),
b as (select CATEGORY_CODE, GENDER_CODE, AGE, count(*) as CNT_PER from SCHOOL_HEALTH
inner join a using (CATEGORY_CODE, GENDER_CODE, AGE)
where round(AVERAGE_VALUE+0.0001, 1) >= AVGV and SURVEY_YEAR = 2019
group by CATEGORY_CODE, GENDER_CODE, AGE),
c as (select CATEGORY_CODE, GENDER_CODE, AGE, count(*) as CNT from SCHOOL_HEALTH
inner join a using (CATEGORY_CODE, GENDER_CODE, AGE)
where SURVEY_YEAR = 2019
group by CATEGORY_CODE, GENDER_CODE, AGE),
d as (
select AGE, (case GENDER_CODE when 20 then "MALE" else "FEMALE" end) as GENDER,
AVGV AS H_AVG,
substr(cast(round(cast (CNT_PER as float)* 100 / cast (CNT as float), 1) as real) || '000', 1, length(cast(round(cast (CNT_PER as float)* 100 / cast (CNT as float), 1) as integer)) + 2) || "%" as H_PER
from a
left join b using (CATEGORY_CODE, GENDER_CODE, AGE)
left join c using (CATEGORY_CODE, GENDER_CODE, AGE)
where CATEGORY_CODE = "10"),
e as (
select AGE, (case GENDER_CODE when 20 then "MALE" else "FEMALE" end) as GENDER,
AVGV AS W_AVG,
substr(cast(round(cast (CNT_PER as float)* 100 / cast (CNT as float), 1) as real) || '000', 1, length(cast(round(cast (CNT_PER as float)* 100 / cast (CNT as float), 1) as integer)) + 2) || "%" as W_PER
from a
left join b using (CATEGORY_CODE, GENDER_CODE, AGE)
left join c using (CATEGORY_CODE, GENDER_CODE, AGE)
where CATEGORY_CODE = "20")
select AGE, GENDER, cast(H_AVG as char) as H_AVG, H_PER, cast(W_AVG as char) as W_AVG , W_PER from d left join e using(GENDER, AGE)
order by AGE desc, GENDER asc
提出情報
提出日時 | 2023/08/21 08:03:29 |
コンテスト | 第8回 SQLコンテスト |
問題 | 身長と体重 |
受験者 | Tomii9273 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 85 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
85 MB