I am just wondering what a DB reacts (or should react) to an UPDATE statement that includes an identical update. By this I mean updating a column with exactly the same value as what is currently found.
SET col_1 = col_1
Does the database actually update the column with the self-same new value or is it clever enough to skip execution, "Oh, the new value is the same as the old one. No need to start an update for this row. Next!"?
Thanks rudy. I was actually thinking of branching update values using CASE:
SET col_1 = CASE WHEN <cond 1>
THEN col_1 * 10
WHEN <cond 2>
THEN col_1 * 5
ELSE col_1 END
I wondered if writing "ELSE col_1" makes the execution considerably slow compared to a statement that has "<cond 1> OR <cond 2>" in a WHERE clause. Glad to know that I don't have to worry about it for MySQL. Still, I will wait for info about "da standard" and other DB products.
By the way, what if the ELSE condition were "col_1 * 1"? Maybe SQL is not very good at processing equations?