In my fictional database, I have several columns of data. In designing a PHP front-end to the script, it was necessary to allow the user to modify all attributes of a tuple if necessary.
If the end-user only ends up modifying one attribute instead of all of them, the following statement:
UPDATE foo
SET name='bar' location='YYZ' drink='ale'
where user='smithj'`
Would update all three attributes of the tuple "smithj", even if two of the attributes are the same.
Is there a way to have SQL (MySQL, if it makes a difference) automatically filter out the redundant updates, similar to the IF EXISTS
clause in CREATE TABLE IF EXISTS
?
Thanks!