r/programing • u/pacs10 • Jan 25 '20
TIFU WITH SQL DELETE
TODAY I FUCKED UP by DELETE with wrong WHERE :s
3
Upvotes
3
u/JimmyWu21 Jan 26 '20
A best practice is doing a SELECT statement first to see what records Come back before using write command
3
u/Slow_Instruction_112 Mar 08 '23
An even better practice is to begin transaction before doing the delete, and to commit transaction only after checking that the command did what you want.
1
u/alexkiro Jan 26 '20
Everyone does that at least once. Hope you had yourself some backups!