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