|
I'm so used to writing:
SELECT * FROM [table name]
That you can bet when it's time to delete I'll write:
DELETE * FROM [table name]
I no longer blame myself.
I consider it a language design bug thingy.
|
|
|
|
|
I've found a very easy way to completely avoid making any mistakes in SQL: I don't use SQL.
|
|
|
|
|
What's SQL...?
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill
America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde
Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
|
|
|
|
|
Colin Mullikin wrote: What's SQL...?
An advanced language for querying databases that doesn't involve tons of ridiculously intricate frameworks and mysterious black box middle-tier software. Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done.
|
|
|
|
|
MehGerbil wrote: An advanced language for querying databases
Don't know if I would call it advanced.
|
|
|
|
|
Clifford Nelson wrote: Don't know if I would call it advanced.
Having written code for databases that didn't have it I would certainly call it advanced.
|
|
|
|
|
Then we have made no progress in 40 years since SQL was developed, if a 40 year old technology is advanced. You must think that there has also been no significant improvement in software languages in since Fortran 1V.
|
|
|
|
|
Clifford Nelson wrote:
Then we have made no progress in 40 years since
SQL was developed, if a 40 year old technology is advanced. You must think that
there has also been no significant improvement in software languages in since
Fortran 1V.
That of course has nothing to do with what I said.
Unless of course you think that Fortan or something like C++/C+#/Python exist to solve data storage problems.
|
|
|
|
|
MehGerbil wrote: Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done Water, meet monitor.
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill
America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde
Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
|
|
|
|
|
The nice thing about it is that you have so many different standard implementations of SQL to choose from, too!
|
|
|
|
|
You're lucky man. I often wake up in a cold sweat in the middle of the night wondering if I left out the WHERE clause when executing a DELETE .
/ravi
|
|
|
|
|
I figured I was the only one so I was too embarrassed to ever post about it here. O.o
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Yet you quote a DBA.
|
|
|
|
|
Oh, you weren't supposed to see that.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Pretend it is because you thought your were writing for the Jet Engine. (which uses this)
|
|
|
|
|
Always write the WHERE clause first, even if it doesn't need one.
WHERE 1=2 is always a good choice until you've got the rest worked out.
Me, what I usually screw up with is forgetting which database I'm on.
Oh, you mean I just wiped the production database? Oops.
|
|
|
|
|
Solid advice but the ONLY time I ever use the delete command is to clear test database tables. I never use delete in production - everything is a log and if the user doesn't want to see it anymore a flag is set on the record.
I was getting burned too often by people who would blame me for bad data.
Every item and every change is logged and nothing is ever deleted.
|
|
|
|
|
|
Agreed, solid advice, but cloud storage (my company is in Azure now) makes soft deletes expensive. What we've started doing is setting soft deletes on large blobs, then purging those older than 90 days every month or so; if they don't notice it in 90 days, then YAGNI
|
|
|
|
|
I use Squirrel a redneck SQL;
GIMME what I need FROM [table name]
DELETE what I don't need FROM [table name]
|
|
|
|
|
They didn't teach us that variant in school...
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill
America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde
Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
|
|
|
|
|
I went to a southern college.
|
|
|
|
|
Are you OSS'ing it? I'm originally from Texas, so I'm sure I could assist.
|
|
|
|
|
I got into the habit of making myself look at the thing I wanted to delete before deleting.
|
|
|
|
|
Me too!
- Life in the fast lane is only fun if you live in a country with no speed limits.
- Of all the things I have lost, it is my mind that I miss the most.
- I vaguely remember having a good memory...
|
|
|
|