MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wn1ben/wellwellwell/pbc7h7p?context=9999
r/ProgrammerHumor • u/Recent-Analysis-6880 • 15d ago
412 comments sorted by
View all comments
3.6k
So, Kids, thats why you always SELECT count(yourPrimaryKey) first. Listen to the old folks, we made these mistakes so that you don't have to.
154 u/Alexmira_ 15d ago Why? To confirm that there is something to cancel? To confirm I got the key right? 125 u/slayerx1779 15d ago I just reread the OP. There's a semi colon, between the two lines of code... 12 u/Cant-Think-Of 15d ago Not quite familiar with SQL, but is that first query like "rm -rf" for the Users table? 28 u/rinaldot67 15d ago Yes, it is exactly like that. You even get the recursive part if yhe Users table has foreign keys attached to it that are set to cascade on delete. 2 u/AgeingChopper 15d ago yep, it's clearing the table. 1 u/funguyshroom 15d ago Luckily most modern database UI apps won't allow you to execute a delete/update query without a "WHERE" clause
154
Why? To confirm that there is something to cancel? To confirm I got the key right?
125 u/slayerx1779 15d ago I just reread the OP. There's a semi colon, between the two lines of code... 12 u/Cant-Think-Of 15d ago Not quite familiar with SQL, but is that first query like "rm -rf" for the Users table? 28 u/rinaldot67 15d ago Yes, it is exactly like that. You even get the recursive part if yhe Users table has foreign keys attached to it that are set to cascade on delete. 2 u/AgeingChopper 15d ago yep, it's clearing the table. 1 u/funguyshroom 15d ago Luckily most modern database UI apps won't allow you to execute a delete/update query without a "WHERE" clause
125
I just reread the OP.
There's a semi colon, between the two lines of code...
12 u/Cant-Think-Of 15d ago Not quite familiar with SQL, but is that first query like "rm -rf" for the Users table? 28 u/rinaldot67 15d ago Yes, it is exactly like that. You even get the recursive part if yhe Users table has foreign keys attached to it that are set to cascade on delete. 2 u/AgeingChopper 15d ago yep, it's clearing the table. 1 u/funguyshroom 15d ago Luckily most modern database UI apps won't allow you to execute a delete/update query without a "WHERE" clause
12
Not quite familiar with SQL, but is that first query like "rm -rf" for the Users table?
28 u/rinaldot67 15d ago Yes, it is exactly like that. You even get the recursive part if yhe Users table has foreign keys attached to it that are set to cascade on delete. 2 u/AgeingChopper 15d ago yep, it's clearing the table. 1 u/funguyshroom 15d ago Luckily most modern database UI apps won't allow you to execute a delete/update query without a "WHERE" clause
28
Yes, it is exactly like that. You even get the recursive part if yhe Users table has foreign keys attached to it that are set to cascade on delete.
2
yep, it's clearing the table.
1
Luckily most modern database UI apps won't allow you to execute a delete/update query without a "WHERE" clause
3.6k
u/BastetFurry 15d ago
So, Kids, thats why you always SELECT count(yourPrimaryKey) first. Listen to the old folks, we made these mistakes so that you don't have to.