Re: DELETE rows from Table lists

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Joe Celko (joe.celko_at_northface.edu)
Date: 03/26/04


Date: Fri, 26 Mar 2004 12:04:18 -0800


>> the Table Names in the Table which contains the list of Tables and
corresponding rows are variable ... <<

Ignoring the fact that you should never pass a table name as a variable
and avoid dynamic SQL in production code, I have another question for
you:

Why do you build a table for this operation instead of putting the query
that builds the deletions into the WHERE clause of a properly written
DELETE statement (i.e. compiles and used on one and only one base
table)?

This is a sequential file model we used in tape systems in the 1950's --
a transaction tape is run against a Master file. Today, we can use DRI
actions and avoid most of this kind of processing completely -- the
system casades the DELETE for us, without having to use a scratch tape
or work file.

Would you mind taking a quick survey for me? I have teach to several
hundred new SQL programmers in the next year. You have made a typical
"Newbie Error" and I want to know what your underlying assumptions were
that lead to the flaw -- your "logic of failure", as it were. You can
answer to my email instead of on the newsgroup.

1) How many years/months have your been programming? Was your first
language a procedural language? Was your first language an OO language?

2) How many years/months have your been programming in SQL?

3) Have you used a sequential file system before?

4) Have you used a network Database before?

5) Have you ever had a course in Data Modeling?

6 Have you ever had a course in RDBMS theory? University or commercial?

7) Have you ever had a course in SQL? University or commercial?

I am not picking on you; I want to know how you came to ask this
question.

--CELKO--
 ===========================
 Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages