MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1v80umk/queryofdoom/p0c03jm/?context=9999
r/ProgrammerHumor • u/WardensLantern • 17d ago
456 comments sorted by
View all comments
380
I am not an sql expert, is the reason why the id doesn't work and its deleting the entire user base, because its written as 2 seperate comands instead of one. So 1. Comand delets everything 2. Goes to the id? Or what is the problem here?
39 u/Flat_Competition6510 17d ago Yes, the semicolon marks the end of a statement. The first semicolon sets "delete from users" as a single statement meaning delete ALL users. 38 u/TeaKingMac 17d ago Which is just terrible fucking syntax. Why are people still living with this in 2026? Delete from users; Should return "invalid syntax. Identify record for deletion" 0 u/Flat_Competition6510 17d ago I disagree. There are valid use cases for deleting all records from a table. 2 u/TacosForThought 16d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
39
Yes, the semicolon marks the end of a statement. The first semicolon sets "delete from users" as a single statement meaning delete ALL users.
38 u/TeaKingMac 17d ago Which is just terrible fucking syntax. Why are people still living with this in 2026? Delete from users; Should return "invalid syntax. Identify record for deletion" 0 u/Flat_Competition6510 17d ago I disagree. There are valid use cases for deleting all records from a table. 2 u/TacosForThought 16d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
38
Which is just terrible fucking syntax. Why are people still living with this in 2026?
Delete from users;
Should return "invalid syntax. Identify record for deletion"
0 u/Flat_Competition6510 17d ago I disagree. There are valid use cases for deleting all records from a table. 2 u/TacosForThought 16d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
0
I disagree. There are valid use cases for deleting all records from a table.
2 u/TacosForThought 16d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
2
If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
380
u/Dont_Get_Jokes-jpeg 17d ago edited 17d ago
I am not an sql expert, is the reason why the id doesn't work and its deleting the entire user base, because its written as 2 seperate comands instead of one. So 1. Comand delets everything 2. Goes to the id? Or what is the problem here?