コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with sa as (
select
row_number() over(order by sum(total_value) desc) as ranking,
pf_code,
sum(total_value) as sales,
sum(total_value) over() as sumtotal
from convenience
where survey_year='2019' and kind_code='100'
group by pf_code
),
cnt as (
select
pf_code,
sum(total_value) as count
from convenience
where survey_year='2019' and kind_code='150'
group by pf_code
),
sumtbl as (
select
ranking,
sa.pf_code as code,
sales,
count,
sum(sales) over(order by ranking rows 2 preceding) as TTL_SAL,
sum(sales) over(order by ranking) as subtotal,
sumtotal,
sum(count) over(order by ranking rows 2 preceding) as gsum_shop
from sa
inner join cnt
on sa.pf_code=cnt.pf_code
order by sales desc,count,code
)
select
ranking/3 as NO,
TTL_SAL,
round(cast(TTL_SAL as real)/cast(sumtotal as real)*100,1) as PER_SAL,
round(cast(subtotal as real)/cast(sumtotal as real)*100,1) as CUM_SAL,
cast(cast(TTL_SAL as real)/cast(gsum_shop as real) as int) as AVG_SAL
from sumtbl
where ranking%3=0
order by NO;
提出情報
提出日時 | 2024/06/23 21:17:36 |
コンテスト | 第9回 SQLコンテスト |
問題 | 販売額分析 |
受験者 | kate |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 89 MB |
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
88 MB
データパターン2
AC
87 MB
データパターン3
WA
89 MB