ソースコード
WITH IMPORT as (
    SELECT
        PORT_CODE,
        AMT
    FROM
        IMMIGRATION AS IM
    WHERE
        GROUP_CODE = '120'
        and KIND_CODE = '110'
    GROUP BY
        PORT_CODE
),
EXPORT as (
    SELECT
        PORT_CODE,
        AMT
    FROM
        IMMIGRATION AS IM
    WHERE
        GROUP_CODE = '120'
        and KIND_CODE = '120'
    GROUP BY
        PORT_CODE
)
SELECT
    P.PORT_CODE as "港コード",
    P.PORT_NAME as "港名",
    I.AMT as "入国者数",
    E.AMT as "出国者数",
    (I.AMT - E.AMT) as "差分"
    FROM PORT as P
    INNER JOIN IMPORT as I on P.PORT_CODE = I.PORT_CODE
    INNER JOIN EXPORT as E on P.PORT_CODE = E.PORT_CODE
    WHERE I.AMT > E.AMT
    ORDER BY "差分" DESC, P.PORT_CODE DESC
提出情報
提出日時2022/10/24 13:32:02
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者asd
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
76 MB