2 つのテーブルを持つデータベースがあります。それらをtableおよびtableWithUpdatedValuesと呼びましょう
テーブル構造は同じで、わずかな列 ( title、plot、review ) しかありません。tableの列も更新されています。
どちらも想定できる値は、NULL、1、および 2 です。
Null = '' = string.empty != 1
Null = '' = string.empty != 1
Null = '' = string.empty != 2
1 != 2
tableWithUpdatedValuesからtableに値をコピーし、2 つのテーブルのプロット値またはレビュー値が異なり、宛先テーブルの値が null でない場合を除き、すべての場合に更新フラグを 1 に設定したいと考えています。動作にも違いがあります。値が異なるが、tableWithUpdatedValuesの値が null の場合、テーブルの値を保持します。
コンセプトは非常に簡単で直感的です。Null は役に立たない値です。1 と 2 は代わりに同じ値を持ちます。1 または 2 を null で上書きすることは決してありません。また、1 を 2 で上書きすること、またはその逆で競合が発生します (したがって、上書きしません)。
http://en.wikipedia.org/wiki/Karnaugh_map
テーブルが対称的であることに気付きました
サンプルデータ
Title: Vajont
Plot on table = ''
Plot on tableWithUpdatedValues = 'Nice movie'
Result wanted on table:
plot = 'Nice movie'
updated = 'true'
Title: Lost in Translation
Plot on table = 'Nice movie'
Plot on tableWithUpdatedValues = 'Very nice movie'
Result wanted on table:
plot = 'Nice movie'
updated = 'false'