The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
Solid advice but the ONLY time I ever use the delete command is to clear test database tables. I never use delete in production - everything is a log and if the user doesn't want to see it anymore a flag is set on the record.
I was getting burned too often by people who would blame me for bad data.
Every item and every change is logged and nothing is ever deleted.
Agreed, solid advice, but cloud storage (my company is in Azure now) makes soft deletes expensive. What we've started doing is setting soft deletes on large blobs, then purging those older than 90 days every month or so; if they don't notice it in 90 days, then YAGNI
If get in the habit of putting all your statements inside a transaction, then if you realize you made a mistake you can roll it back without affecting the table.
Of course, you have to remember to commit the transaction in a timely manner, otherwise the table remains locked.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein