ソースコード
SELECT
    p.PORT_CODE AS "港コード",
    p.PORT_NAME AS "港名",
    entry.AMT AS "入国者数",
    exit.AMT AS "出国者数",
    entry.AMT - exit.AMT AS "差分"
FROM
    IMMIGRATION AS i
    JOIN PORT AS p ON p.PORT_CODE = i.PORT_CODE
    JOIN GRP AS g ON g.GROUP_CODE = i.GROUP_CODE
    JOIN (SELECT PORT_CODE, AMT FROM IMMIGRATION WHERE KIND_CODE = 110) AS entry ON entry.PORT_CODE = i.PORT_CODE
    JOIN (SELECT PORT_CODE, AMT FROM IMMIGRATION WHERE KIND_CODE = 120) AS exit ON exit.PORT_CODE = i.PORT_CODE
WHERE
    g.GROUP_NAME = "外国人"
    AND (entry.AMT - exit.AMT) > 0
GROUP BY
    p.PORT_CODE
ORDER BY
    "差分" DESC,
    "港コード" DESC
提出情報
提出日時2024/09/05 00:17:35
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者sakats
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
90 MB
データパターン2
AC
83 MB