Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
複雑なDBがあり、次のことを行う必要があります。
複雑なトランザクションの後、何が追加されたかを判断するために、現在のデータベースと最初のデータベースの以前の状態を表す2番目のデータベースとの間で何らかの差分レポートを作成する必要があります。
削除されたデータを判別する必要はありません。たとえば、比較するテーブルが5〜10個あります。だから私はそれを一つずつまたはすべて一緒に行うことができます。
目標を達成するための最良のSQL式は何でしょうか?
最高、アスカー
tableXの場合、
select current_db.tableX.id from current_db.tableX left outer join earlier_db.tableX on current_db.tableX.id = earlier_db.tableX.id where earlier_db.tableX.id is null