ソースコード
SELECT A.PORT_CODE AS 港コード
     , B.PORT_NAME AS 港名
     , (SELECT SUM(AMT)
          FROM IMMIGRATION
         WHERE GROUP_CODE = '120' AND KIND_CODE = '110'
         GROUP BY PORT_CODE) AS 入国者数
     , (SELECT SUM(AMT)
          FROM IMMIGRATION
         WHERE GROUP_CODE = '120' AND KIND_CODE = '120'
         GROUP BY PORT_CODE) AS 出国者数
     , (SELECT SUM(AMT)
          FROM IMMIGRATION
         WHERE GROUP_CODE = '120' AND KIND_CODE = '110'
         GROUP BY PORT_CODE) - 
       (SELECT SUM(AMT)
          FROM IMMIGRATION
         WHERE GROUP_CODE = '120' AND KIND_CODE = '120'
         GROUP BY PORT_CODE) AS 差分
  FROM IMMIGRATION AS A
 INNER JOIN PORT AS B
    ON A.PORT_CODE = B.PORT_CODE
 INNER JOIN GRP AS C
    ON A.GROUP_CODE - C.GROUP_CODE
 ORDER BY  差分 DESC , 港コード DESC 
提出情報
提出日時2022/07/20 18:00:02
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者takayama
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
102 MB
データパターン2
WA
105 MB