It does annoy me that the WHERE clause has to go at the end. I usually end up typing the WHERE clause first when working live on something important.
Same with rm -Rf /foo/bar. There's a moment when pressing enter will do the wrong thing. I usually use relative paths to avoid this, but I have had to repair the damage for someone who actually managed to rm -Rf / by accident due to this.
That is why I run a ls command before doing rm. (been bitten but accidentally hitting Return key instead of Shift on laptop :()
Also for Update/Delete query I run the equivalent select (rows or count(*) ) query first, just to make sure.
also make sure to write where predicate before completing the whole sql. (The sql does not go through by accidentally hitting enter, before the whole statement is written)
tl;dr - Run read operation before doing write/update/delete operations.
Doubt it, I'm really careful with updates and usually I only have a few hours work between me and fixing a mistake like that, not a million dollars. Maybe a certain discount was applying to everything, more likely that every actual price being changed in the db.
Comments
An UPDATE sql statement with a forgotten WHERE clause
It does annoy me that the WHERE clause has to go at the end. I usually end up typing the WHERE clause first when working live on something important.
Same with rm -Rf /foo/bar. There's a moment when pressing enter will do the wrong thing. I usually use relative paths to avoid this, but I have had to repair the damage for someone who actually managed to rm -Rf / by accident due to this.
That is why I run a ls command before doing rm. (been bitten but accidentally hitting Return key instead of Shift on laptop :()
Also for Update/Delete query I run the equivalent select (rows or count(*) ) query first, just to make sure.
also make sure to write where predicate before completing the whole sql. (The sql does not go through by accidentally hitting enter, before the whole statement is written)
tl;dr - Run read operation before doing write/update/delete operations.
Doubt it, I'm really careful with updates and usually I only have a few hours work between me and fixing a mistake like that, not a million dollars. Maybe a certain discount was applying to everything, more likely that every actual price being changed in the db.