# Re: Grammatical Inconsistencies

From: Timothy J. Bruce <uniblab_at_hotmail.com>
Date: 24 Apr 2004 13:42:35 -0700

Laconic2, Dawn, et al:

> Just a minor quibble. If you really want the projection, you'll say
> `SELECT DISTINCT F.B FROM F, G WHERE F.A = G.C;'
Did you bother to read the definition of F.A, F.B, and G.C ? Since there is no possibility of F.B repeating, as the relations and sets have been defined, your quibble is orthogonal. Your quibble is additionally distracting. Please give Dawn enough room to crawl before we force her to run. Please let the above sink in before you clobber her with this irrelevancy.

> SQL should have made "SELECT" default to "SELECT DISTINCT" instead of
> "SELECT ALL". The fact that people don't like SELECT DISTINCT for
> performance reasons, is something the optimizer should be able to deal
> with, not the SQL programmer.
The problem is not what we `like' or what we `dislike'; the problem is SQL is *NOT* relationally compliant. Let us define set D = {foo, bar, baz, quux} and set E = {x, y}, and relation H as a subset of E x D such that H = { (x, foo), (y, foo), (x, bar), (y, baz), (x, quux), (y, quux) }.
The projection of relation H onto D *should* yield {foo, bar, baz, quux}, but in SQL the projection (via the statement `SELECT D FROM H;') will instead yield {foo, foo, bar, baz, quux, quux}. This is _most_obviously_ incorrect, and is a problem with SQL (an evil pox on the head of all programmers) which should be corrected.

> In your example, if we can know from the constraints that SELECT ALL and
> SELECT DISTINCT will produce identical results, then the optimizer should
> be able to deduce that, and do the right thing.
In my example there was never any danger of the SELECT statement contradicting the expected result.
Just as your comments about the DISTINCT key-word is orthogonal, so too are your comments about the query optimizer. Your orthogonality compounded by orthogonality is creating DISTRACTION where CONCENTRATION is required. While the above is a very good continuation for the general public's education you should have introduced it on a sound premise and preferably after the immediate goal of offering some well-deserved (required) assistance (education) was met.

I thank you for your efforts, but hope you did not cause more Harm than Help in this matter. To paraphrase: "The truly insane have enough on their plates without us adding to it." -- Formosa's Law.

Or maybe I'm just plain wrong,
Timothy J. Bruce
uniblab_at_hotmail.com
</RANT> Received on Sat Apr 24 2004 - 22:42:35 CEST

Original text of this message