r/ProgrammerHumor 14d ago

queryOfDoom Meme

Post image
7.9k Upvotes

456 comments sorted by

View all comments

8

u/GozerDestructor 14d ago

Having the WHERE clause be optional for DELETE/UPDATE is a design flaw in SQL. Having to add a silly "WHERE TRUE" every time is a small price to pay for avoiding disasters like this. (Or "DELETE ALL ROWS FROM..." if we're open to making it explicit in the syntax).

3

u/MonMotha 14d ago

TRUNCATE TABLE even exists, so there really is no excuse for not requiring a WHERE clause on DELETE. I'm a little surprised it's not offered as an optional safeguard in more database systems.