ソースコード
SELECT
IMMIGRATION.PORT_CODE AS '港コード',
PORT.PORT_NAME AS '港名',
CASE WHEN GROUP_CODE = '120' AND KIND_CODE = '110' /*AND AMT IS NOT NULL*/ THEN AMT END AS '入国者数',
CASE WHEN GROUP_CODE = '120' AND KIND_CODE = '120' /*AND AMT IS NOT NULL*/ THEN AMT END AS '出国者数'
/*外国人入国者のAMT - 外国人出国者のAMTの計算結果 AS '差分'*/
FROM IMMIGRATION
JOIN PORT ON IMMIGRATION.PORT_CODE = PORT.PORT_CODE
/*WHERE '入国者数' > '出国者数'*/
GROUP BY IMMIGRATION.PORT_CODE
ORDER BY /*'差分' DESC,*/ IMMIGRATION.PORT_CODE DESC;


SELECT 
IMMIGRATION.PORT_CODE AS '港コード',
PORT.PORT_NAME AS '港名',
CASE WHEN KIND_CODE = '110' THEN AMT END AS '入国者数',
CASE WHEN KIND_CODE = '120' THEN AMT END AS '出国者数',
GROUP_CODE,KIND_CODE
FROM IMMIGRATION
JOIN PORT ON IMMIGRATION.PORT_CODE = PORT.PORT_CODE
WHERE /*IMMIGRATION.PORT_CODE = '50720'
AND*/ GROUP_CODE = '120'
/*GROUP BY IMMIGRATION.PORT_CODE*/;
提出情報
提出日時2022/07/21 12:04:23
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者adjmk
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
77 MB