ソースコード
SELECT
	a.PORT_CODE as 港コード,
	b.PORT_NAME as 港名,
	sum_AMT_110 as 入国者数,
	sum_AMT_120 as 出国者数,
	AMT_diff as 差分
FROM 
	(SELECT 
		d_110.PORT_CODE ,
		sum_AMT_110,
		sum_AMT_120,
		sum_AMT_110 - sum_AMT_120 as AMT_diff
	FROM 
		(SELECT PORT_CODE, sum(AMT) as sum_AMT_110 FROM IMMIGRATION WHERE KIND_CODE = "110" and GROUP_CODE = "120" GROUP BY PORT_CODE ) as d_110
	inner join 
		(SELECT PORT_CODE, sum(AMT) as sum_AMT_120 FROM IMMIGRATION WHERE KIND_CODE = "120" and GROUP_CODE = "120" GROUP BY PORT_CODE ) as d_120
	ON
		d_110.PORT_CODE = d_120.PORT_CODE
	WHERE
		sum_AMT_110 > sum_AMT_120
	) as a 
inner join
	PORT as b
ON
	a.PORT_CODE = b.PORT_CODE
ORDER BY AMT_diff DESC
;
提出情報
提出日時2022/07/20 21:27:49
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者sugusan
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量102 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
46 MB
データパターン2
AC
102 MB