コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with
e as (
select
pf_code
,'ELEMENTARY' as kind
,sum(elementary) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
union
select
pf_code
,'MIDDLE' as kind
,sum(middle) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
union
select
pf_code
,'HIGH' as kind
,sum(high) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
union
select
pf_code
,'JUNIOR_CLG' as kind
,sum(junior_clg) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
union
select
pf_code
,'COLLEGE' as kind
,sum(college) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
union
select
pf_code
,'GRADUATE' as kind
,sum(graduate) as amt
from
enrollment_status
where
survey_year = 2020
group by
1
),
k as (
select
'ELEMENTARY' as kind
union
select
'MIDDLE' as kind
union
select
'HIGH' as kind
union
select
'JUNIOR_CLG' as kind
union
select
'COLLEGE' as kind
union
select
'GRADUATE' as kind
),
pk as (
select
p.pf_code
,p.pf_name
,k.kind
from
prefecture p
cross join k
)
select
2020 as SV_YEAR
,pk.pf_name as PREFECTURE
,pk.kind as KIND
,e.amt as AMT
from
pk
join
e
on
pk.pf_code = e.pf_code
and pk.kind = e.kind
where
amt is not null
order by
pk.pf_code asc, pk.kind('ELEMENTARY','MIDDLE','HIGH','JUNIOR_CLG','COLLEGE','GRADUATE')
提出情報
提出日時 | 2022/09/21 18:35:15 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | takahirostone |
状態 (詳細) | RE (Runtime Error: 実行時エラー) |
メモリ使用量 | 98 MB |
メッセージ
SQLITE_ERROR: near "(": syntax error
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
98 MB
データパターン2
RE
98 MB