ソースコード
SELECT 
    A.PORT_CODE AS '港コード',
    PORT_NAME AS '港名',
    SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 110 THEN B.AMT ELSE 0 END) AS '入国者数',
    SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 120 THEN B.AMT ELSE 0 END) AS '出国者数',
    SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 110 THEN B.AMT ELSE 0 END) - SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 120 THEN B.AMT ELSE 0 END) AS '差分'
FROM 
    PORT AS A
JOIN 
    IMMIGRATION AS B ON A.PORT_CODE = B.PORT_CODE
JOIN 
    GRP AS C ON B.GROUP_CODE = C.GROUP_CODE
GROUP BY 
    A.PORT_CODE, PORT_NAME
HAVING 
    SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 110 THEN B.AMT ELSE 0 END) - SUM(CASE WHEN C.GROUP_CODE = 120 AND B.KIND_CODE = 120 THEN B.AMT ELSE 0 END) >= 0;
提出情報
提出日時2024/06/27 16:38:11
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者jagariko
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
105 MB
データパターン2
WA
100 MB