ソースコード
select
    PORT_CODE as "港コード",
    PORT_NAME as "港名",
    sum_into_amt as "入国者数",
    sum_outo_amt as "出国者数",
    sum_into_amt - sum_outo_amt as "差分"
from (
    select
        immigration.port_code,
        port_name,
        sum(iif(immigration.group_code = "120" and kind_code = "110", amt, 0)) as sum_into_amt,
        sum(iif(immigration.group_code = "120" and kind_code = "120", amt, 0)) as sum_outo_amt
    from
        immigration
    inner join
        port
    on
        immigration.port_code = port.port_code
    inner join
        grp
    on
        immigration.group_code = grp.group_code
    group by
        immigration.port_code
)
where
    sum_into_amt > sum_outo_amt
order by
    "差分" desc,
    "港コード" desc
提出情報
提出日時2022/09/21 00:19:09
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者koya_346
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
78 MB