ソースコード
select
    PORT.PORT_CODE as "港コード",
    PORT.PORT_NAME as "港名",
    sum(
        case
            when IMMIGRATION.KIND_CODE = "110" then IMMIGRATION.AMT
            else 0
        end
    ) as "入国者数",
    sum(
        case
            when IMMIGRATION.KIND_CODE = "120" then IMMIGRATION.AMT
            else 0
        end
    ) as "出国者数",
    sum(
        case
            when IMMIGRATION.KIND_CODE = "110" then IMMIGRATION.AMT
            when IMMIGRATION.KIND_CODE = "120" then - IMMIGRATION.AMT
            else 0
        end
    ) as "差分"
from
    PORT
    join IMMIGRATION on PORT.PORT_CODE = IMMIGRATION.PORT_CODE
group by
    IMMIGRATION.PORT_CODE
having
    sum(
        case
            when IMMIGRATION.KIND_CODE = "110" then IMMIGRATION.AMT
            when IMMIGRATION.KIND_CODE = "120" then - IMMIGRATION.AMT
            else 0
        end
    ) > 0
order by
    "差分" desc,
    "港コード" desc;
提出情報
提出日時2023/11/05 02:47:19
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者c8a
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
88 MB
データパターン2
AC
80 MB