コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with wk as (
select
MONTHLY,
0 as MRR,
COALESCE(LAST_VALUE(NEW_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING), 0) as LAST_NEW_MRR,
COALESCE(LAST_VALUE(EXPANSION_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING), 0) as LAST_EXPANSION_MRR,
COALESCE(LAST_VALUE(DOWNGRADE_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING), 0) as LAST_DOWNGRADE_MRR,
COALESCE(LAST_VALUE(CHURN_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING), 0) as LAST_CHURN_MRR
from MRR_DATA
),
wk2 as (
select
MONTHLY,
COALESCE(SUM(MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 0)
+ COALESCE(SUM(LAST_NEW_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 0)
+ COALESCE(SUM(LAST_EXPANSION_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 0)
- COALESCE(SUM(LAST_DOWNGRADE_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 0)
- COALESCE(SUM(LAST_CHURN_MRR) OVER (ORDER BY MONTHLY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 0)
AS MRR
from wk
)
select
*
from wk2
提出情報
提出日時 | 2023/02/28 01:21:06 |
コンテスト | 第5回 SQLコンテスト |
問題 | MRRの集計 |
受験者 | fiction0111 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 80 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
80 MB
データパターン3
WA
80 MB