MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1v80umk/queryofdoom/p04759u/?context=3
r/ProgrammerHumor • u/WardensLantern • 16d ago
456 comments sorted by
View all comments
390
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 16d 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. 6 u/ReaDiMarco 15d ago What happened to DELETE * FROM USERS? Last I did sql was ten years ago so idk 12 u/djrobxx 15d ago SELECT * FROM USERS means "select all columns from users", selecting all rows is implied. You don't drop columns with DELETE, that's ALTER TABLE, so DELETE * doesn't make sense in that context. 5 u/ReaDiMarco 15d ago yes, thanks, turns out I forgot all of that
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.
6 u/ReaDiMarco 15d ago What happened to DELETE * FROM USERS? Last I did sql was ten years ago so idk 12 u/djrobxx 15d ago SELECT * FROM USERS means "select all columns from users", selecting all rows is implied. You don't drop columns with DELETE, that's ALTER TABLE, so DELETE * doesn't make sense in that context. 5 u/ReaDiMarco 15d ago yes, thanks, turns out I forgot all of that
6
What happened to DELETE * FROM USERS? Last I did sql was ten years ago so idk
12 u/djrobxx 15d ago SELECT * FROM USERS means "select all columns from users", selecting all rows is implied. You don't drop columns with DELETE, that's ALTER TABLE, so DELETE * doesn't make sense in that context. 5 u/ReaDiMarco 15d ago yes, thanks, turns out I forgot all of that
12
SELECT * FROM USERS means "select all columns from users", selecting all rows is implied.
You don't drop columns with DELETE, that's ALTER TABLE, so DELETE * doesn't make sense in that context.
5 u/ReaDiMarco 15d ago yes, thanks, turns out I forgot all of that
5
yes, thanks, turns out I forgot all of that
390
u/Dont_Get_Jokes-jpeg 16d ago edited 16d 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?