News for hackers. Stuff that matters.
Re:An administrator accidentally deleted the production data... by leftnode on Wednesday March 23, 2016 @07:24AM (#11343470)
You can also start all of your commands with "BEGIN;" (at least in Postgres) to ensure you're in a transaction you can easily rollback.

Another trick it to start all "DELETE" commands as a "SELECT" to ensure you get the "WHERE" part correct, and then swap out the "SELECT *" with a "DELETE".

Re:An administrator accidentally deleted the production data... by oneeyedpigeon on Wednesday March 23, 2016 @07:50AM (#11343583)
I use the latter almost religiously. Also can be useful to add a LIMIT on the end, just to guard against an UPDATE running amok. And I tend to write my queries 'backwards' (e.g. starting with the WHERE clause, ending with the "DELETE", to guard against executing the query prematurely.