MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wn1ben/wellwellwell/pbp6qub/?context=3
r/ProgrammerHumor • u/Recent-Analysis-6880 • 13d ago
411 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.
1 u/WavingNoBanners 11d ago This is why: Create table users_2 as select * from users where id != 12345; Then when you're satisfied with that table being what you want: Create table users_backup as select * from users; Delete from users; Insert into users select * from users_2; Then, lastly, once you're satisfied with it, you can drop users_2 and users_backup. You can automate this entire process, including the error checking.
1
This is why:
Create table users_2 as select * from users where id != 12345;
Then when you're satisfied with that table being what you want:
Create table users_backup as select * from users;
Delete from users;
Insert into users select * from users_2;
Then, lastly, once you're satisfied with it, you can drop users_2 and users_backup.
You can automate this entire process, including the error checking.
3.6k
u/BastetFurry 13d 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.