Dennis Cote <[EMAIL PROTECTED]> wrote:
> 
> I'm particularly interested in the value of avg(a). My reading of the 
> standard leads me to believe that avg(a) should be 3 (i.e. an integer 
> value) and not a floating point value. This is similar to the earlier 
> discussion of the results for division with integers (i.e. 5/2 -> 2 vs 
> 5/2 -> 2.5).
> 
> I would like to know if other databases follow the standard here or not. 
> If you have ready access to another database, please try this and post 
> the result. It will save me lots of time setting up other programs (and 
> hopefully get info on programs I don't have access to like Oracle).
> 

Did you try sum(a)/count(a) instead of avg(a).

   SQLite version 3.3.3
   Enter ".help" for instructions
   sqlite> create table t (a integer, b real);
   sqlite> insert into t values (3, 3);
   sqlite> insert into t values (3, 3);
   sqlite> insert into t values (4, 4);
   sqlite> select avg(a), sum(a)/count(a) from t;
   3.33333333333333|3

Kind of seems wrong, doesn't it....
--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to