Re: Much Ado about Nothing

From: Bob Badour <bbadour_at_golden.net>
Date: Sat, 24 Feb 2001 14:07:30 -0500
Message-ID: <DDUl6.818$8e4.195417252_at_radon.golden.net>


David,

You bring up an important point. The SQL model and the relational model differ on a number of very important points with the most important being: relations must be in first normal form and SQL tables need not be.

Specifically, this means that SQL allows duplicate rows and SQL allows NULL.

I really do not see what is "practical" about not knowing both models when working in SQL. One needs to know where SQL falls short to avoid the pitfalls.

Since you bring up NULL, I would like to present my favourite example.

NULL breaks a large number of mathematical identities that we all take for granted. My favourite is:

SUM(A) + SUM(B) = SUM(A + B) In North America, we spend countless millions of dollars every year drilling this fact into the heads of our children. We all spent many hours (from first grade on) sorting and counting and grouping and drilling to fully internalize the above number fact.

The identity above is not "just theory". People understand it at a very concrete and practical level. The farmer who has two nannies and three cows knows he has to get up early and milk five animals. If he builds another barn and buys one more nanny and two more cows, he knows that he has three nannies, five cows and must milk eight animals.

The farmer won't understand a system where moving all the cows into one barn and all the nannies into the other barn suddenly means he has no animals to milk and no milk to sell.

I have seen many instances where "practical" database practitioners with many years of experience have written views or queries that yield incorrect or inconsistent results due to the impact of NULL on the above identity or similar identities. Errors that neither these practitioners nor their users can readily identify because the practitioners dismiss relational as "just theory".

Don't get me wrong, I am not accusing you. I am not claiming you make those errors, I am not claiming you are incapable of identifying such errors, and I am not claiming you dismissed the relational model as "just theory".

I am taking you to task, however, for even suggesting that it is somehow "practical" to know the SQL model without knowing and understanding the relational model.

I have seen far too many self-proclaimed database experts who will argue to the death that databases need NULL and duplicate rows for "practical" reasons while dismissing the relational model as "just theory". In every such case, the person was incapable of recognizing the many and obvious negative consequences of NULL and duplicate rows.

That said, the SQL model was based on the relational model, and SQL is by far the most commercially accepted language based on the relational model. I like to think of SQL as the most dismal experiment that ever succeeded.

SQL succeeded because it demonstrated that a relational database would work and that mere human beings could write optimizers for relational DBMSes. SQL succeeded because it demonstrated that physical independence and logical independence are possible -- even if it did not attempt to fully achieve those goals. SQL succeeded because it demonstrated how much easier it is to exchange data identified by value with other systems. As an experiment, SQL succeeded by too many measures to fully enumerate here.

However, I find it rather dismal because the experiment was productized and rapidly accepted by the market somewhat prematurely. SQL succeeded by demonstrating what an awful idea NULL is and by demonstrating the horrible problems of duplicate rows. Unfortunately, SQL is now stuck with both for all time. Received on Sat Feb 24 2001 - 20:07:30 CET

Original text of this message