ソースコード
with WEEK_TBL as(
    select '0' as WEEK_NO, '日' as WEEK
    union select '1' as WEEK_NO, '月' as WEEK
    union select '2' as WEEK_NO, '火' as WEEK
    union select '3' as WEEK_NO, '水' as WEEK
    union select '4' as WEEK_NO, '木' as WEEK
    union select '5' as WEEK_NO, '金' as WEEK
    union select '6' as WEEK_NO, '土' as WEEK
    )
, DATA_TBL as(
    select
        strftime('%w',SALES_DATE) as WEEK_NO
        ,count(SALES_NO) as CNT_ORDER
        ,round(avg(SALES_AMT),0) as AVG_AMT
    from
        SALES
    where
        SALES_TYPE <> 2
        and UPDATED_NO is null
    group by
        SALES_DATE
    )
    
select
    W.WEEK
    ,ifnull(round(avg(CNT_ORDER)),0) as AVG_CNT
    ,ifnull(sum(AVG_AMT) || '円','0円') as AVG_AMT
from
    DATA_TBL as D
    right outer join
    WEEK_TBL as W
    on D.WEEK_NO=W.WEEK_NO
group by
    W.WEEK_NO
order by
    W.WEEK_NO;
    
提出情報
提出日時2024/04/19 14:05:02
コンテスト第12回 SQLコンテスト
問題曜日別売上分析
受験者honyara
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
WA
85 MB