Datamation's Proposed Extention to SQL Language (#1)

From: Michael Sallwasser <msallwas_at_world.nad.northrop.com>
Date: Tue, 12 Jul 1994 22:59:43 GMT
Message-ID: <CsunvL.A92_at_gremlin.nrtc.northrop.com>


In the June 1, 1994 issue of Datamation, the cover story proposes 3 extensions to the SQL language. In an article, "SQL is our language. Fix it now.", the editors suggest three extensions that appear syntactically compatible with SQL as I know it. Here is the first of the three. I have made my comments. I would be interested in reading yours.

[If you have not read the article, what follows may not be very clear]

#1 ALTERNATE clause:

This feature would allow two group functions to be used in the same select statement with different selection criteria for each group function. The ALTERNATE constraint replaces all constraints on the same table in the surrounding query.

The example they give is for comparing this year's sales with last year's sales by productname. The syntax might be:

	select item.name,
	       sum(sales.amt)/sum(alternate sales.amt where sales.year = 1993)
	from sales,
	     item
	where sales.item_id = item.id
          and sales.year = 1994
	group by item.name;

The intention is that the WHERE clause within the alternate clause would replace that all parts of the main WHERE clause other than join conditions.

I believe a clearer syntax might be as follows:

	select item.name,
	       sum(sales.amt where sales.year=1994)/
                     sum(sales.amt where sales.year=1993)
	from sales,
	     item
	where sales.item_id = item.id
	group by item.name;

In this case, there is no replacement, the WHERE clause within the group function provides constraints in addition to those contained with the main WHERE clause.


Either way, this feature would be of benefit to the customers that I support. If the SQL could be generated by the various third party GUI tools we use that would be even better.

-- 
============================================================================
Michael Sallwasser  | Down one path is utter dispair and hopelessness. Down 
Northrop Grumman    | the other is total destruction. Let us choose wisely.
Received on Wed Jul 13 1994 - 00:59:43 CEST

Original text of this message