Ivan, aggregative tests

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Dec 11 11:21:43 CST 2003


Hi Ivan,

I have look into Select_Semantic_Errors.cpp on aggr tests.

1) first of all note, that you have tests only for the whole table

        select *, sum(f) FROM T

But you also should make tests with GROUP BY. Here there is small
difference. Fields in the SELECT MUST be only fields mentioned in the GROUP
BY clause. So this is SEMANTIC error:

        select f1, f2, sum(f2)
        FROM T
        GROUP BY f2


f1 cannot present here.
And in any aggr expression.
This is also wrong:

        select f1 + f2, sum(f2)
        FROM T
        GROUP BY f2



2) By standard 

        SELECT f1, f2, f3, f4, min(f)

    is wrong. Standard say we cannot mix aggregative and normal columns.
    
But I believe this is not very correct.
IF we have only min/max in the SELECT, then we do not have ambiguity, and we
still can correctly show other fields of found min/max record.

Okay, here must be even more strict!

        SELECT f1, f2, f3, f4, min(f), max(f)

This already is wrong, because min an max will choose DIFFERENT records.
And we cannot show f1, f2, f3.

So we can DIFFER from standard, IF select have only min() or only max()
function. 

Agree?


So correct all SQL tests:
    GOOD, Error tests, according to all this comments.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list