ソースコード
SELECT
    merged.PORT_CODE AS '港コード', 
    merged.PORT_NAME AS '港名', 
    merged.comeAMT AS '入国者数',
    merged.awayAMT AS '出国者数',
    merged.comeAMT- merged.awayAMT AS '差分'
    From
        (
        (SELECT
            P.PORT_CODE,
            P.PORT_NAME,
            I.AMT AS 'comeAMT'
        from
            PORT P
        INNER JOIN
            IMMIGRATION I
        ON
            P.PORT_CODE = I.PORT_CODE
        WHERE
            I.KIND_CODE = 110 AND I.GROUP_CODE = 120
        ORDER by P.PORT_CODE) come
    INNER JOIN
        (SELECT
            P.PORT_CODE,
            P.PORT_NAME,
            I.AMT AS 'awayAMT'
        from
            PORT P
        INNER JOIN
            IMMIGRATION I
        ON
            P.PORT_CODE = I.PORT_CODE
        WHERE
            I.KIND_CODE = 120 AND I.GROUP_CODE = 120
        ORDER by P.PORT_CODE) away
    ON
        come.PORT_CODE = away.PORT_CODE
        ) merged
order by merged.comeAMT- merged.awayAMT DESC, merged.PORT_CODE DESC
提出情報
提出日時2023/11/08 18:35:24
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者yamamtmg
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
90 MB
データパターン2
WA
83 MB