ソースコード
SELECT --更新
	t1.ITEM_CODE AS CODE
	,t1.ITEM_NAME AS NAME
	,'UPDATED' AS COMP_RSLT
FROM ITEM AS t1
WHERE EXISTS(
	SELECT 1
	FROM ITEM_HISTORY AS t2
	WHERE t1.ITEM_CODE = t2.ITEM_CODE
		AND t1.USER_UPDATE_DATETIME <> t2.USER_UPDATE_DATETIME
		)
UNION

SELECT --追加
	t1.ITEM_CODE AS CODE
	,t1.ITEM_NAME AS NAME
	,'ADDED' AS COMP_RSLT
FROM ITEM AS t1
WHERE NOT EXISTS(
	SELECT 1
	FROM ITEM_HISTORY AS t2
	WHERE t1.ITEM_CODE = t2.ITEM_CODE
		)
UNION

SELECT --削除
	t2.ITEM_CODE AS CODE
	,t2.ITEM_NAME AS NAME
	,'DELETED' AS COMP_RSLT
FROM ITEM_HISTORY AS t2
WHERE NOT EXISTS(
	SELECT 1
	FROM ITEM AS t1
	WHERE t1.ITEM_CODE = t2.ITEM_CODE
		)
ORDER BY CODE DESC
提出情報
提出日時2024/04/19 17:41:00
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者katsu
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
85 MB
データパターン3
AC
85 MB