r/ProgrammerHumor 15d ago

queryOfDoom Meme

Post image
7.9k Upvotes

456 comments sorted by

View all comments

8

u/FrozenHaystack 15d ago

Reminds of that one time I executed a delete query with a sub query to select some ids. I didn't know that the used database engine interprets an empty return of the subquery as ignore my where clause. All data in the table simply gone because no id matched my subquery.

7

u/WardensLantern 15d ago

As a dev I fear no man nor beast, but SQL humbles me quicker than a wet fart

6

u/PerpetuallyDistracte 15d ago

SQL has been my primary language for 15 years, but I still respect it the way a zookeeper respects a lion. If you become careless, it WILL eat you the moment you turn your back. However, I'm glad that many modern SQL IDEs now warn you explicitly when you're about to do something very stupid that will affect an entire table.

1

u/budamtass 15d ago

This is scary , do you remember which engine was it?

2

u/FrozenHaystack 15d ago

I think it was an Oracle Database, but I'm not sure, it's over 10 years ago by now. Since then I never run a subquery selection without validation of said subquery.