Hacker News new | past | comments | ask | show | jobs | submit login

A buddy of mine showed me a cool trick to avoid this type of problem. What you do is first use SELECT to see the records in question:

   SELECT * from some_table where idx >= 5
Then, once you are staring at the records that came back (and are sure they are the ones you want to delete), change SELECT * to DELETE (and change nothing else) and rerun.

   DELETE from some_table where idx >= 5
Pretty hard to get it wrong with this approach ;-)



Or even better, SELECT(*) FROM some_table - that way the developer won't be tempted to skip the step because of too many records scrolling through their screen... not that I learned that from personal experience or anything ;-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: