ソースコード
SELECT
    PORT.PORT_CODE AS "港コード",
    PORT.PORT_NAME AS "港名",
    SUM(CASE WHEN KIND_CODE = "110" THEN AMT ELSE 0 END) AS "入国者数",
    SUM(CASE WHEN KIND_CODE = "120" THEN AMT ELSE 0 END) AS "出国者数",
    SUM(CASE WHEN KIND_CODE = "110" THEN AMT ELSE 0 END) - SUM(CASE WHEN KIND_CODE = "120" THEN AMT ELSE 0 END) AS "差分"
FROM
    IMMIGRATION AS IMM
INNER JOIN
    PORT AS PORT
ON PORT.PORT_CODE = IMM.PORT_CODE

GROUP BY
    PORT.PORT_CODE,
    PORT.PORT_NAME
HAVING
    SUM(CASE WHEN KIND_CODE = "110" THEN AMT ELSE 0 END) - SUM(CASE WHEN KIND_CODE = "120" THEN AMT ELSE 0 END) > 0
ORDER BY
    SUM(CASE WHEN KIND_CODE = "110" THEN AMT ELSE 0 END) - SUM(CASE WHEN KIND_CODE = "120" THEN AMT ELSE 0 END) DESC,
    PORT.PORT_CODE DESC
提出情報
提出日時2022/07/20 20:43:45
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者neterukun
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量101 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
101 MB
データパターン2
AC
97 MB